Closed Garima-github-24 closed 3 weeks ago
Why not use an adapter for height
straight up?
series.columns.template.adapters.add("height", function(height, target) {
let dataItem = target.dataItem;
if (condition) {
return 18;
}
return height;
})
I tried your above solution. In this case, target.dataItem is undefined and I need to set my condition based on target.dataItem.dataContext. Hence, it's of no use for my scenario.
Also, in my solution using
series.columns.template.adapters.add('fill', function (fill, target) {
let dataItem = target.dataItem;
// Set condition here based on dataItem.dataContext
if (condition) {
target.set('height',18);
target.set('cursorOverStyle', 'default');
}
return fill;
});
I checked by debugging, the height is still set to 18 for specific column but at time of rendering it's getting reset to default 12 sometimes.
Column height is set by series. If it happens after fill
adapter kicks in, your target.set("height", 18)
is overwritten.
Thus the need to have separate adapter for height
.
And the data item should be present in all column adapters:
series.columns.template.adapters.add("height", function(height, target) {
console.log(target.dataItem.dataContext);
return height;
})
Data item was undefined sometimes. Used null check to rectify. Thanks a lot, it's working as expected.
This issue is stale because it has been open 30 days with no activity. It will be closed in 5 days unless a new comment is added.
Hi,
I am using the XY chart column series adapter to set the column height based on a condition like below:
In this case, the specific column has an increased height of 18 when chart is first loaded. But when we refresh the chart series data using
this.chart.series.getIndex(0).data.setAll(this.chartData)
, the height gets reset to default 12px (height set for all columns) randomly. While thecursorOverStyle
is still 'default' as set for that specific column.Kindly confirm if this is a bug with amcharts 5.