Stacked Bar Chart

Stacked Bar Chart

  

Hi 

Looking for help/referencewqsa in creating Stacked Bar chart using the data from the aggregate


Regards



Sunil Babar

Hi Sunil,

What exactly are you running into? What have you tried so far?

Hi Kilian

So far, i created an aggregate which gets be count of Quotes provided and the placements provided.  I wish to create a stacked BAR Chart which display the counts mentioned above.

What i am not getting is how do i place two labels and their respective values on the chart.  I tried using advanceformat.init and added HighchartsJSON. Assigned it to advance format property of the chart. However,  it did not work.


Sunil Babar

Hi sunil,

Try this code in json :

SyntaxEditor Code Snippet

"
  chart: {
        
        marginTop: 60
    },
legend: {
            layout: 'vertical',
            backgroundColor: 'white',
            align: 'left',
            position: 'top',
            verticalAlign: 'top',
            borderWidth: 1,
            borderRadius: 0,
            floating: true,
            draggable: true,
           itemMarginRight:5,
            zIndex: 100
        },
plotOptions: 
    {
        series: {
            pointWidth: 30,
            dataLabels: {
                enabled: false,
                format: '{point.y:.0ff}'
            },
            animation:{
                duration:1000,
            },
            point: {
                events: {
                    click: function () {
                                        
                    }
                }
            }
        }
    },
xAxis: 
    {
        type: 'category',
    },
yAxis: 
    {
        title: 
        {
            text: ''
        }
    },
tooltip: 
{

    
    backgroundColor: '#ffffff',
    borderColor: '#cccccc',
    borderRadius: 3,
    borderWidth: 1,
    formatter: function() {
         
        return  this.x + ' <br> ' + this.series.name+' : ' +this.y + '<br><span style=color:#2379da;><b>Total : </b></span>'+ this.point.stackTotal    ;
    }

}

"
Solution

Hi Sunil,

There is more than one way to achieve a simple stacked column chart. The key is to use the "stack" setting to group data series together.

Say you have a DataPoint List containing three series, the first having DataSeriesName "Series1", the second having "Series2", the third "Series3". To stack the first two (but keep the third independent), use the AdvancedFormat_Init function as input to the chart's AdvancedFormat Input Parameter. One of its parameters is the DataSeriesFormats parameter, that takes a list of AdvancedDataSeriesFormat structures. For this scenario you need two elements, one for Series1, and one for Series2. Set the DataSeriesName Attribute to "Series1" and "Series2" respectively, and set the DataSeriesJSON Attribute to "stack: 'stack1'" (or whatever name for this stack you like).

This should give you a stacked column chart.

Solution

Hi Killian

Thanks for your response!

I've been trying to get this stacked bar chart by applying couple of ways, however the way you suggested sounds more feasible and easier.  My graph is for List of Insurers, how many quotes they have provided and how many have they accepted.  So I've 3 data points all from an aggregate. 

I got fews questions:

1. Do I've to add a For Each loop here, so that my data points are updated in the DATAPOINT list structure defined

2.AdvanceFormat_init, how to assign multiple data points to DataSeriesFormats ( when I assigned the Datapoint structure, it just gave one attribute to assign)

3.  I cannot assign Insurer data point in DATAPOINT_INIT, so how can I have insurer listed against their quotes provided and quote accepted

I've attached the OML for your reference, please let me know where am I going wrong here.

My apologies for this, I've been trying to get this, however was not finding any relevant guide

(Please do not work on the OML, just let me know, where am i going wrong)


Regards


Sunil Babar


Thanks Killian!

Your suggestion worked very well....


Cheers!

Sunil Babar

Hi Sunil,

Great I could be of help, and great you found out yourself in the end. Apologies for not replying to your previous post, but analyzing source code takes some time and I was otherwise occupied. Happy coding!