0
votes

I'm trying to plot a stacked column graph. Instead of the various components being one on top of the other, they are appearing one next to the other.

Here's the property I'm using

var stackedProps= {
    type: "serial",
    titles: [{
            text: "STACKED CHART",
            size: 24,
            alpha: 5
        }],
    valueAxis: [{
            stackType: "regular",
            axisAlpha: 0.3,
            gridAlpha: 0
        }],
    graphs: [{
            balloonText: "<b>[[title]]</b><br><span style='font-size:14px'>[[category]]: <b>[[value]]</b></span>",
            fillAlphas: 0.8,
            lineAlpha: 0.3,
            title: "AAAA",
            type: "column",
            color: "#000000",
            valueField: "AAAA"
        }, {
            balloonText: "<b>[[title]]</b><br><span style='font-size:5px'>[[category]]: <b>[[value]]</b></span>",
            fillAlphas: 0.8,
            lineAlpha: 0.3,
            title: "BBBB",
            type: "column",
            color: "#000000",
            valueField: "BBBB"
        }
};

My understanding is that the property stackType: "regular" is responsible for stacking the items one on top of the other.

Could I please request help to identify the mistake?

1
You have a misspelled setting "valueAxis". Should be valueAxes (plural) - martynasma
Hello Martyn - In my case, using valueAxis works while the plural form doesn't plot the graph - usert4jju7
There's no such setting as "valueAxis", so it is ignored. It's the same as you would have "santaClaus" :) Jokes aside, "valueAxes" should work as the rest of your chart config seems to be fine. Maybe you can share your data as well, so I can try your chart? - martynasma
Hey Martyn - Just as you posted, I was about to update my answer :) So, here is what I was doing. I had copied over the standard column graph properties over to stacked column & kept changing the valueAxis property of both of these types of graphs to valueAxes` (the plural form). What is working now is valueAxes for stacked column & valueAxis for the normal column graph. if I change the column graph property to valueAxes the graph doesn't plot. - usert4jju7
Hey Martyn - If you could post your comment in the answer section, I'll accept it as the answer :) - usert4jju7

1 Answers

1
votes

The serial charts support multiple value axes. Therefore the property is valueAxes (plural form).

If you have it as "valueAxis" (as it seems the case in your code), it is ignored by the chart like any other unknown property, hence columns not being stacked.

So bottom line, if you want to stack your columns, you define valueAxes. If you don't want to stack them, you can completely leave out that part. (unless you want to set some other value axis settings)