Thursday, March 31, 2011

ASP.NET and the new Chart Control

I'm looking through the asp:chart documentation and I don't see where you set a "ChartType" on a ChartArea. How do you make a simple 2D PieChart? I don't see where you set the type at all.

Note: Adapt Gordon's answer to ASP.NET. Close enough to get me on the correct path. Thanks.

From stackoverflow
  • using System.Windows.Forms.DataVisualization.Charting;
    ...
    
    // Populate series data
    double[]    yValues = {65.62, 75.54, 60.45, 34.73, 85.42};
    string[]    xValues = {"France", "Canada", "Germany", "USA", "Italy"};
    chart1.Series["Default"].Points.DataBindXY(xValues, yValues);
    
    // Set Pie chart type
    chart1.Series["Default"].ChartType = SeriesChartType.Pie;
    
    // Set labels style
    chart1.Series["Default"]["PieLabelStyle"] = "Outside";
    
    tyndall : Aha. ChartType is on the Series. -1 cool point for me.

0 comments:

Post a Comment