Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8623

drawOnSecondaryAxis problem in combination chart

$
0
0

I created a makit combination chart, including a column chart layer and a line chart layer.

 

When drawOnSecondaryAxis is false in both layers, they can show successfully as expected.

 

However, if drawOnSecondaryAxis is set false in any layer, the chart can not show and an exception is reported.

 

The exception on the console is:

    Uncaught TypeError: Cannot read property 'toString' of undefined  (from SybaseMA-dbg.js:469)

 

I checked my code against online examples but could not find a clue. Could anyone help? Thanks.

 

My code is as below:

 

var testData = {

    mycollection : [

        { year : 2008, product : "Prod 1", revenue : 900000, profit : 120000 },

        { year : 2008, product : "Prod 2", revenue : 700000, profit : 100000 },

        { year : 2008, product : "Prod 3", revenue : 800000, profit : 70000 },

        { year : 2009, product : "Prod 1", revenue : 1000000, profit : 128000 },

        { year : 2009, product : "Prod 2", revenue : 900000, profit : 115000 },

        { year : 2009, product : "Prod 3", revenue : 1080000, profit : 120000 },

        { year : 2010, product : "Prod 1", revenue : 1100000, profit : 95000 },

        { year : 2010, product : "Prod 2", revenue : 1200000, profit : 130000 },

        { year : 2010, product : "Prod 3", revenue : 1000000, profit : 110000 }

    ]

};

var jsonModel = new sap.ui.model.json.JSONModel();

jsonModel.setData(testData);

 

var oCombChart = new sap.makit.CombinationChart({

    height: "90%", width: "100%",

    showRangeSelector : true,

    categoryRegions : [ new sap.makit.Category({ column : "yearCategory", displayName : "Year" })],

    legendPosition : sap.makit.LegendPosition.Bottom

});

 

var oChartLayer1 = new sap.makit.Layer({

    type : sap.makit.ChartType.Column,

    series : new sap.makit.Series({ column : "productSeries", displayName : "Product Revenue", format : "currency" }),

    values : [new sap.makit.Value({ expression : "revenueValue", format : "currency" })]

});

oCombChart.addLayer(oChartLayer1);

oChartLayer1.addColumn(new sap.makit.Column({name:"yearCategory", value:"{year}"}));

oChartLayer1.addColumn(new sap.makit.Column({name:"productSeries", value:"{product}"}));

oChartLayer1.addColumn(new sap.makit.Column({name:"revenueValue", value:"{revenue}", type:"number"}));

oChartLayer1.setModel(jsonModel);

oChartLayer1.bindRows("/mycollection");

 

var oChartLayer2 = new sap.makit.Layer({

    type : sap.makit.ChartType.Line,

    drawOnSecondaryAxis : true ,

    series : new sap.makit.Series({ column : "profitSeries" }),

    values : [new sap.makit.Value({ expression : "profitValue", format : "rounded2" })],

});

oCombChart.addLayer(oChartLayer2);

oChartLayer2.addColumn(new sap.makit.Column({name:"yearCategory", value:"{year}"}));

oChartLayer2.addColumn(new sap.makit.Column({name:"profitSeries", value:"{product}"}));

oChartLayer2.addColumn(new sap.makit.Column({name:"profitValue", value:"{profit}", type:"number"}));

oChartLayer2.setModel(jsonModel);

oChartLayer2.bindRows("/mycollection");


Viewing all articles
Browse latest Browse all 8623

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>