Is it possible to add an additional label to each bar of a columnchart without it having any bearing on the presentation of the bar the labels exist on?
This is my current chart set up
this.populationChart.myChartObject.data = {
'cols': [
{ id: 's', label: 'Stage', type: 'string' },
{ id: 'v', label: 'Value', type: 'number' },
{ id: 'p', label: 'Percent', type: 'number' },
{ role: 'style', type: 'string' }
], 'rows': [
{
c: [
{ v: 'Meet Criteria' },
{ v: this.populationSummary.inDatabase },
{ v: this.studyService.calcPercent(this.populationSummary.inDatabase, this.populationSummary.total) },
{ v: '#e94926' }
]
},
{
c: [
{ v: 'Invited' },
{ v: this.populationSummary.invited },
{ v: this.studyService.calcPercent(this.populationSummary.invited, this.populationSummary.inDatabase) },
{ v: '#62b8af' }
]
},
{
c: [
{ v: 'Screened' },
{ v: this.populationSummary.screened },
{ v: this.studyService.calcPercent(this.populationSummary.screened, this.populationSummary.invited) },
{ v: '#f2673a' }
]
},
{
c: [
{ v: 'Qualified' },
{ v: this.populationSummary.qualified },
{ v: this.studyService.calcPercent(this.populationSummary.qualified, this.populationSummary.screened) },
{ v: '#ffc828' }
]
},
{
c: [
{ v: 'Scheduled' },
{ v: this.populationSummary.scheduled },
{ v: this.studyService.calcPercent(this.populationSummary.scheduled, this.populationSummary.screened) },
{ v: '#5a5538' }
]
}
]
};
calcPercent = (numerator: number, denominator: number): number => {
if (denominator === 0) {
return 0;
};
if (denominator !== 0) {
return (Math.round((numerator / denominator) * 100));
};
};
Right now the behaviour is showing two bars per stage. One bar for value of the value
label, and one bar for the percentage
label.
What I want is for each bar's height to be based on the value
label, and when I mouse over the bar the popup shows the value
label, and that label's val, but also show the percentage
label.
Basically have the bar's height/presentation only be based off the value
label, but show both labels and their values when moused over.
Is this possible?
'style'
column role, you can use a'tooltip'
column role to customize the values shown on bar hover -- use this in place of the percentage column -- see this answer for an example... – WhiteHat