-
I have a stacked bar chart where I'm using the vg.plot(vg.barY(vg.from(tableName), {
x: 'year',
y: vg.count(),
z: 'my_group',
fill: 'my_group',
order: 'z',
offset: 'normalize',
reverse: true,
}),
vg.yTickFormat('%'),
vg.yLabel('Percentage of Events'),
vg.xLabel('Year'),
vg.width(width),
vg.height(height * 0.8),
vg.marginLeft(60),
vg.marginBottom(40),
vg.marginTop(20),
// vg.text(vg.from(tableName), {
// text: vg.count(), // This isn't right. it doesn't print out the normalized percentage value
// x: 'year',
// y: vg.count(),
// z: 'my_group',
// order: 'z',
// offset: 'normalize',
// reverse: true,
// })) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The vg.text element is indeed creating another plot, of type text, on the same y-axis as your normalized one. For the text chart, the y-axis is vg.count() rather than the normalized value. I think this is because offset only applies to stacked mark types. One workaround could be to add tip: true to the barY element, which does show the normalized amount in the tooltip. |
Beta Was this translation helpful? Give feedback.
The vg.text element is indeed creating another plot, of type text, on the same y-axis as your normalized one. For the text chart, the y-axis is vg.count() rather than the normalized value. I think this is because offset only applies to stacked mark types.
One workaround could be to add tip: true to the barY element, which does show the normalized amount in the tooltip.