amcharts / amcharts5

The newest, fastest, and most advanced amCharts charting library for JavaScript and TypeScript apps.
Other
350 stars 92 forks source link

Change column alignment #1774

Open Zahar661 opened 3 hours ago

Zahar661 commented 3 hours ago

Hello everyone I can't find a solution anywhere(( It is possible somehow in a graph with column clustering disabled, provided that there are only 6 columns, 3 need to be positioned to the left and 3 to the right. I can't use categories (It seems to me it should be like that, but it doesn't work.

column1.columns.template.setAll({
            width: am5.percent(48),
            fillOpacity: 0.4,
            strokeOpacity: 0,
            align: "left"
        });
column2.columns.template.setAll({
            width: am5.percent(35),
            fillOpacity: 0.7,
            strokeOpacity: 0,
            align: "left"
        });
column3.columns.template.setAll({
            width: am5.percent(15),
            fillOpacity: 1,
            strokeOpacity: 0,
            align: "left"
        });
column4.columns.template.setAll({
            width: am5.percent(48),
            fillOpacity: 0.4,
            strokeOpacity: 0,
            align: "right"
        });
column5.columns.template.setAll({
            width: am5.percent(35),
            fillOpacity: 0.7,
            strokeOpacity: 0,
            align: "right"
        });
column6.columns.template.setAll({
            width: am5.percent(15),
            fillOpacity: 1,
            strokeOpacity: 0,
            align: "right"
        });

align, centerX, pading not work((

martynasma commented 3 hours ago

If you need to have two separate stacks, you can set stacked: false on the series that you want to start a new stack on.

Here's a demo: https://www.amcharts.com/demos/stacked-clustered-column-chart/

Zahar661 commented 1 hour ago

@martynasma Thanks, but it doesn't work. It looks as it should, but it sums up the values of the columns image

As in this example, only 2 columns are needed. https://www.amcharts.com/demos/layered-column-chart/

martynasma commented 1 hour ago

I'm not sure what you're asking. If you need columns overlapping, you set clustered: false, if you need them stacked, you use stacked: true.

Zahar661 commented 50 minutes ago

I want there to be 2 columns without clustering. next to each other. I think you need to use categories, but how to do it with DateAxis. Here is an example, if I set DateAxis, then there are no categories, if I set CategoryAxis, then the graph is not formed.

https://codepen.io/Zahar661/pen/PoMOggX

martynasma commented 20 minutes ago

If you don't want clustering, you need to set clustered: false on all ColumnSeries.

Zahar661 commented 1 minute ago

image It is necessary to move the purple columns to the right, and the blue ones to the left.