ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Combo Chart - Mutiple Bar & Multiple Line dynamically
Posted by Venkat Pat on Apr-26-2011 18:41
Hello

We are the registered users of ChartDirect

Can i have some sample ASP.Net/C# Code for combo charts - multiple bar & multiple line
which i have to display these dynamically.

Thank you.

Venkat

  Re: Combo Chart - Mutiple Bar & Multiple Line dynamically
Posted by Peter Kwan on Apr-26-2011 21:50
Hi Venkat,

You just need to add one or multiple bar layers and multiple line layers. There is some sample code in ChartDirector which shows charts with both bars and lines. For example, see the sample code "Pareto Chart" and "Dual Y Axis".

An example is like:

    double[] data0 = {42, 49, 33, 38, 64, 56, 29, 41, 44, 57, 59, 42};
    double[] data1 = {65, 75, 47, 34, 42, 49, 73, 62, 90, 69, 66, 78};
    double[] data2 = {36, 28, 25, 28, 38, 20, 22, 30, 25, 33, 30, 24};
    string[] labels = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
        "Oct", "Nov", "Dec"};

    XYChart c = new XYChart(600, 375);
    c.setPlotArea(50, 55, 500, 280);

    c.xAxis().setLabels(labels);

    c.addBarLayer(data0, 0xff0000, "Bars");
    c.addLineLayer(data1, 0x00ff00, "Line 1");
    c.addLineLayer(data2, 0x0000ff, "Line 2");

    WebChartViewer1.Image = c.makeWebImage(Chart.PNG);

Hope this can help.

Regards
Peter Kwan