c3js / c3js/c3

Hidden columns data are available to the plot, but not to the tooltip building function

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

Description

My charts (timeseries, to be precise) show two data series in the plot.

Actually the data series that are available to me are four, but two of them are non-numerical and therefore not plottable.

However, when the user moves the mouse in the plot I want the non-numeric values for the chosen day to show in the tooltip.

I have put the non-numerical data inside two columns and immediately set them as hidden:

columns: [
['x'].concat(simResult.xAxis),
['nominalValue'].concat(simResult.nominalValue),
['realValue'].concat(simResult.realValue),
['dataFlag'].concat(simResult.dataFlag),
['action'].concat(simResult.action)
],
hide: ['dataFlag', 'action']

My plot shows only two dataseries, but I can see that the hidden series are available as greyed out links at the bottom of the plot. So far, so good.

I have tried to modify the tooltip by overriding the usual function `tooltip.contents(d, defaultTitleFormat, defaultValueFormat, color)`

Problem is: when I debug the function, I see that the param d contains only the two displayed data series!!

I was expecting that `d` would contain ALL the data available to the plot, so to enable me to put dataFlag and action values inside the tooltip.

It looks like I will have to solve my problem by cracking the C3 code and retrieving the non-numerical values through some ugly global ad-hoc object.

--> Can anyone suggest a solution within the boundaries of C3 or D3?

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.