Click here to Skip to main content
15,123,851 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using MS Chart for rendering chart in my application.
In my graph I need few lines to display student data below the line indicates fail students, another line indicating for high scoring etc.

These lines will be generated from database values set by user. I need to show this without adding a new series as if it is done is it is also visible in the Legend and my legend is autogenerating through the database values.

I need this lines to look like a part of chart grid not as a chart data.

Help is needed as I cant find any solution.

1 solution

Perhaps this will help?!

<pre lang="cs">private void LoadCharts(ChartKind chartKind) {
    int[] yval = new int[_stats.Count];
    string[] xval = new string[_stats.Count];
    switch (chartKind) {
        case ChartKind.Count:
            for (int i = 0; i < _stats.Count; i++) {
                yval[i] = int.Parse(_stats[i].Count);
                xval[i] = _stats[i].Name;
        case ...
    chart.Series["Serie"].Points.DataBindXY(xval, yval);
    chart.Series["Serie"].LegendText = chartKind.ToString();


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900