1

enter image description here

         {
        rand = new Random();
        ChartArea ca = new ChartArea();

        DataTable ds = new DataTable();
        ds = GameLib.Reports.GetReportList();
        for (int i = 0; i < 4; i++)
        {

            Chart2.Series.Add("Series" + i.ToString());
            Chart2.ChartAreas.Add("ChartArea" + i.ToString());


            Chart2.Series[i].ChartArea = "ChartArea" + i.ToString();


            Chart2.Series[i].ChartType = SeriesChartType.Bar;

        }

        for (int k = 0; k < 4; k++)
        {
            Chart2.Series[("Series" + k).ToString()].Points.DataBindXY(ds.DefaultView, "ReportID", ds.DefaultView, "ReportName");
        }
    }

This is code to create multiple charts.

Can anybody help me to create multiple chart headers?

i.e i have attached output image,actually each chart has a title,so i want to display the title of each chart.

4
  • i suggest you using zedGraph Commented Dec 16, 2013 at 6:39
  • btw what do you mean by chart header ? Commented Dec 16, 2013 at 7:13
  • Here i am creating a multiple chart area, each chart area should contain name; example ChartArea0 have Report0 like that;can you help me to solve this/ Commented Dec 16, 2013 at 7:31
  • i really wish i help but still can't understand what do you want! can you do some simple explanation like image with paint or something similar, i advise you to make your questions VERY clear in order to get answers from ppl here Commented Dec 16, 2013 at 11:07

1 Answer 1

7

You need to add individual titles to your chart, and then you should dock them to a chartarea.
Like so:

// Add the title
Chart1.Titles.Add("Title1");

// Set the text of the title
Chart1.Titles("Title1").Text = "Chart Area 1 Title";

// Dock the title to a ChartArea
Chart1.Titles("Title1").DockedToChartArea = "ChartArea1";

You can use something like this in a loop or create them all individually.

edit:

Title tt = new Title(); 
tt.Name = "ChartArea1" + t.ToString(); 
// tt.Text = "Performance Warehouses"; 

Chart1.Titles.Add(tt); 
Chart1.Titles[tt.Name].Text = UserName; 
Chart1.Titles[tt.Name].DockedToChartArea = tt.Name; 
Chart1.Titles[tt.Name].IsDockedInsideChartArea = false
Sign up to request clarification or add additional context in comments.

3 Comments

Thank you;for this some more modification: Title tt = new Title(); tt.Name = "ChartArea1" + t.ToString(); // tt.Text = "Performance Warehouses"; Chart1.Titles.Add(tt); Chart1.Titles[tt.Name].Text = UserName; Chart1.Titles[tt.Name].DockedToChartArea = tt.Name; Chart1.Titles[tt.Name].IsDockedInsideChartArea = false;
Did I answer your question or do you need some more help? Otherwise you could mark it as the answer.
stackoverflow.com/help/someone-answers •To mark an answer as accepted, click on the check mark beside the answer to toggle it from greyed out to filled in.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.