I am implementing chart controls ….
I have three forms say form1 form2 form3 …..
in form1 I am showing some data in the form of pie chart
form2 i am showing some data in the form of bar chart .. thats working fine …
my problem is i want to show these two charts in form 3 like over view form… where the user will see all charts …
So when i click on the button the form 3 will be open with the two charts side by side (one is pie chart in form1 , another one is bar chart in form2) if you click on the one of the chart in form3 it will goes to the corresponding form..like this….
would any one have any idea about this how to implement …
Many Thanks in advance….
I would do something this:
1) Create 2 user controls containing a mschart, and call them e.g.
PieChartControlandBarChartControl. Expose a a method to set the current datasource (e.g.SetDataSource(DataTable dt)) and put there the logic to bind the datasource to the PieChart or the BarChart2) Create the 3 forms: in
Form1addPieChartControl, inForm2addBarChartControland inForm3add aSplitContainerwhere you will add both aPieChartControland aBarChartControl.3) Expose
SetDataSource()method also inForm1andForm2(it will just call the corresponding inner control method)4) Expose also
SetDataSource()method inForm3; it will call bothSetDataSource()methods of innerPieChartControlandBarChartControl.5)
Form3has to expose also a custom property (e.g.ChartClicked) indicating the chart that has been clicked6) In Form3 subscribe the
Clickevent (orDoubleClick, as you wish) forPieChartControlandBarChartControl7) When
Clickevent is triggered, just set the ChartClicked property and close the formIt will follow some code samples to help you understand my explanation.
Helper enum:
MainForm:
Form3:
Form1:
Form2:
PieChartControl: