PieChart.PieChart C# (CSharp) Method

PieChart() public method

Expects chart values and captions for the chart
public PieChart ( double svalues, string scaptions ) : System
svalues double chart values
scaptions string captions (label) for the various segments in order of values
return System
    public PieChart(double[] svalues, string[] scaptions)
    {
        if (svalues.Length != scaptions.Length)
        {
            throw (new Exception("Length of values must be equal to the length of captions of chart."));
        }

        if (svalues.Length > 10)
        {
            throw (new Exception("Pie chart does not support items more than 10."));
        }

        this.length = svalues.Length;
        this.values = svalues;
        this.captions = scaptions;

        this.CalculateAngles();

        this.chartcolors = new BaseColor[length];
        this.chartcolors[0] = BaseColor.RED;
        if (length > 1) this.chartcolors[1] = BaseColor.GREEN;
        if (length > 2) this.chartcolors[2] = BaseColor.BLUE;
        if (length > 3) this.chartcolors[3] = BaseColor.BLACK;
        if (length > 4) this.chartcolors[4] = BaseColor.YELLOW;
        if (length > 5) this.chartcolors[5] = BaseColor.ORANGE;
        if (length > 6) this.chartcolors[6] = BaseColor.CYAN;
        if (length > 7) this.chartcolors[7] = BaseColor.MAGENTA;
        if (length > 8) this.chartcolors[8] = BaseColor.PINK;
        if (length > 9) this.chartcolors[9] = BaseColor.LIGHT_GRAY;
    }

Same methods

PieChart::PieChart ( double svalues, string scaptions, BaseColor schartcolors ) : System
PieChart::PieChart ( double svalues, string scaptions, System schartcolors ) : System