0% found this document useful (0 votes)
121 views

Column With Rotated Labels - Amcharts

JavaScript chart. How to create a column chart using AmCHarts free JS library

Uploaded by

Mickey Sabu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
121 views

Column With Rotated Labels - Amcharts

JavaScript chart. How to create a column chart using AmCHarts free JS library

Uploaded by

Mickey Sabu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

2/23/22, 4:33 PM Column with Rotated Labels - amCharts

Products Demos Download Buy Support Docs

All demos
Next
Source of the demo

return chart.get("colors").getIndex(series.columns.indexOf(target));

});

series.columns.template.adapters.add("stroke", (stroke, 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

}, {

Column with Rotated Labels Open in:

country: "Spain",

value: 711

In this demo, we create a simple column chart.


}, {

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",

chart) and hide its horizontal (Y) line.


value: 665

}, {

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);

Adapters (used to adjust individual column colors)


// Make stuff animate on load


Demo source
// https://www.amcharts.com/docs/v5/concepts/animations/

series.appear(1000);

chart.appear(1000, 100);
JavaScript TypeScript / ES6 ...

// https://www.amcharts.com/docs/v5/charts/xy-chart/axes/

}); // end am5.ready()


var xRenderer = am5xy.AxisRendererX.new(root, { minGridDistance: 30 });
</script>
xRenderer.labels.template.setAll({

rotation: -90,

<!-- HTML -->

centerY: am5.p50,

<div id="chartdiv"></div>
centerX: am5.p100,

paddingRight: 15

});

var xAxis = chart.xAxes.push(am5xy.CategoryAxis.new(root, {

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,

tooltip: am5.Tooltip.new(root, Products


{})
Demos Download Buy Support Docs
}));

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
});

About amCharts amCharts 5: Maps Pixel Map Generator Support Center



Press Kit WordPress Plugin Visited Countries Map
// Set data
Legal Stuff
var data = [{

Getting support Version information Visited States Map


country: "USA",
Subscribe to amNews Privacy Policy
value: 2025

Terms & Conditions


}, {

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

}, {

country: "South Korea",

value: 443

}, {

country: "Canada",

value: 441

}];

xAxis.data.setAll(data);

series.data.setAll(data);

// Make stuff animate on load

// https://www.amcharts.com/docs/v5/concepts/animations/

series.appear(1000);

chart.appear(1000, 100);

}); // end am5.ready()

</script>

<!-- HTML -->

<div id="chartdiv"></div>

https://www.amcharts.com/demos/column-with-rotated-series/ 2/2

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy