c3js / c3js/c3

Add additional informations to tick

Open
#2,144 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

i have format for tick:

tick: {
fit: true,
multiline: false,
outer: false,
format: function (x) {
var value = this.api.categories()[x];
if(value.length > 5)
return value.substring(0,5)+"...";
else
return value;
}
},

value - unique attribute. But now - i should cut it by 5 symbol.

and i have click on tick:

_.each(this.chart.element.querySelectorAll('svg g.c3-axis-x .tick text tspan'), (el) => {
el.onclick = (e) => this.someFunction(e)
})

in someFunction() - i want to get unique attribute to get data for current tick.

Earliest i got this attribute like angular.element(e.target).text() but it can contain сropped attribute. How i can get current index? or something else to get full text

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.