Column With Rotated Labels - Amcharts
Column With Rotated Labels - Amcharts
All demos
Next
Source of the demo
return chart.get("colors").getIndex(series.columns.indexOf(target));
});
return chart.get("colors").getIndex(series.columns.indexOf(target));
});
// Set data
var data = [{
country: "USA",
value: 2025
}, {
country: "China",
value: 1882
}, {
country: "Japan",
value: 1809
}, {
country: "Germany",
value: 1322
}, {
country: "UK",
value: 1122
}, {
country: "France",
value: 1114
}, {
country: "India",
value: 984
}, {
country: "Spain",
value: 711
We adjust its panning features and mouse wheel behavior right there while creating the object. Then we enable a cursor (that vertical line you see when hovering over the
country: "Netherlands",
}, {
Then we rotate the labels on the X axis and add a country name tooltip shown alongside it when moving a mouse over the chart.
country: "Russia",
value: 580
Next, we add our series – the columns themselves. We associate respective axes, set value fields, and configure the tooltip text (the value tooltip shown on top of the
}, {
column). We also round the top corners of our columns.
country: "South Korea",
value: 443
A finishing touch is adjusting column colors based on their order number.
}, {
country: "Canada",
Related tutorials
value: 441
}];
XY series (the main component of an XY chart)
Cursor
xAxis.data.setAll(data);
Axes
series.data.setAll(data);
series.appear(1000);
chart.appear(1000, 100);
JavaScript TypeScript / ES6 ...
// https://www.amcharts.com/docs/v5/charts/xy-chart/axes/
rotation: -90,
centerY: am5.p50,
<div id="chartdiv"></div>
centerX: am5.p100,
paddingRight: 15
});
maxDeviation: 0.3,
categoryField: "country",
d d
https://www.amcharts.com/demos/column-with-rotated-series/ 1/2
2/23/22, 4:33 PM Column with Rotated Labels - amCharts
renderer: xRenderer,
All demos
Next
Source of the demo
return chart.get("colors").getIndex(series.columns.indexOf(target));
});
More info Products Tools & Resources Contact Us
series.columns.template.adapters.add("stroke", (stroke, target) => {
return chart.get("colors").getIndex(series.columns.indexOf(target));
Accessibility Features amCharts 5: Charts Free SVG Maps contact@amcharts.com
});
country: "China",
value: 1882
}, {
Facebook Twitter LinkedIn Copyright © 2006-2022, amCharts. All rights reserved.
country: "Japan",
value: 1809
}, {
country: "Germany",
value: 1322
}, {
country: "UK",
value: 1122
}, {
country: "France",
value: 1114
}, {
country: "India",
value: 984
}, {
country: "Spain",
value: 711
}, {
country: "Netherlands",
value: 665
}, {
country: "Russia",
value: 580
}, {
value: 443
}, {
country: "Canada",
value: 441
}];
xAxis.data.setAll(data);
series.data.setAll(data);
// https://www.amcharts.com/docs/v5/concepts/animations/
series.appear(1000);
chart.appear(1000, 100);
</script>
<div id="chartdiv"></div>
https://www.amcharts.com/demos/column-with-rotated-series/ 2/2