Dynamically creating charts

后端 未结 1 1802
半阙折子戏
半阙折子戏 2020-12-22 03:59

I am trying to dynamically create a chart for each drive in the computer, inside a form.

Each chart should be a pie chart that contains the amount of free space (co

相关标签:
1条回答
  • 2020-12-22 04:13

    You are almost there.

    But the most basic thing you need to add to a dynamically created chart..:

    charts[i] = new Chart();
    

    ..is a ChartArea:

    charts[i].ChartAreas.Add("CA1"); // pick your name!
    

    Without it no Series can display..

    Use it to style the axis with TickMarks, GridLines or Labels or to set Minima and Maxima and Intervals. Well, at least for most other ChartTypes; Pies don't need any of this anyway..

    Note that you can have several ChartAreas in one Chart.

    Also note that it still will display nothing until at least one Series has at least one DataPoint..

    0 讨论(0)
提交回复
热议问题