I'm trying to create a Chart image which consists of five subcharts.(see Picture)
The X Axis of the Chart should be the same for all 5 subcharts.
How can I realize that with MS Chart Controls?
Currently I'm creating all five Charts, but I have no idea how I can merge the xAxis and how to fit all 5 subcharts into an Image file or Chart.
Thanks for you help in advance!
MsChart allows multiple
ChartArea. Each chart area can have multiple
As per your screen designs, there will be 5 Chart areas. Each
ChartArea will have 1 series added to it.
var chartArea1 = MyChart.ChartAreas.Add("ChartArea 1"); : var chartArea5 = MyChart.ChartAreas.Add("ChartArea 5");
Add Series to charts and assign the chart area
MyChart.Series.ChartArea = chartArea1.Name; MyChart.Series.ChartArea = chartArea5.Name;
Now, to have a common X axis, assign the
chartArea1.AlignWithChartArea = chartArea5.Name; chartArea2.AlignWithChartArea = chartArea5.Name;
You can also refer the link for MSChart.
Update for Chart Area placement Below code is to shows how to position the chart areas within a chart control. Note:- X and Y position are in percentage rather then pixels, twips, etc.
chartArea1.Position.Y = 0; chartArea1.Position.Height = 43; chartArea1.Position.Width = 100; chartArea2.Position.Y = chartArea1.Position.Bottom + 1; chartArea2.Position.Height = chartArea1.Position.Height; chartArea2.Position.Width = chartArea1.Position.Width;