c3js / c3js/c3

Forcing multiline results in tooltip issue

Open
#1,110 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
9.3k
Forks
1.4k
Avg merge
6d 16h
Merged PRs (30d)
1

Description

Hello! I am making a chart at the moment that I am using the multiline functionality to force the axis labels to multiple lines at the place of my choice for the purposes of suiting a mobile screen. To force it I am setting the category value as `[['firstWord','secondWord'],....]` However, when I do so, the tooltip labels come out with a comma.

![image](https://cloud.githubusercontent.com/assets/4165449/7055868/ed5410fc-ddfb-11e4-8544-f73e348b046c.png)

Wanted to flag as a bug for future versions, but if anyone is experiencing this problem as well then an easy fix is to edit the tooltip contents and join the amounts together like so (line 5) -

```
tooltip: {
contents: function(d, defaultTitleFormat, defaultValueFormat, color) {
var out, row, x, _i, _len;
x = d[0].x;
out = '';
for (_i = 0, _len = d.length; _i < _len; _i++) {
row = d[_i];
out += '';
out += '';
}
return out;
}
}
```
' + defaultTitleFormat(x).join(' ') + '';
out += '' + row.name + '' + defaultValueFormat(row.value) + '

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.