Hello,
i have troubles getting my Stacked Area Chart to work the same way it works within a normal Stacked Area Chart.
I defined a DataTable where each Row should be displayed as "one" Area in the Chart.
For example:
Name | Value1 | Value2 | Value3
foo | 1 | 2 | 3
bar | 3 | 3 | 3
In my Stacked Area Chart the "Column-Header"-Names are displayed on the x-axis... each Row is displayed as a singel area.
But i have troubles to define this in the composite Chart, because i'm not able to define the "Column-Header-Row" of my DataTable as the Series.Data.LabelColumn...
Best regards
Harald
For a better understanding.
On top the normal Chart, on Bottom the Chart i tried to create by using a Composite Chart.
The code:
#region DataTable DataTable table = new DataTable(); table.Columns.Add("Name", typeof(string)); table.Columns.Add("Value1", typeof(int)); table.Columns.Add("Value2", typeof(int)); table.Columns.Add("Value3", typeof(int)); table.Rows.Add(new object[ { "foo", 1, 2, 3 }); table.Rows.Add(new object[ { "bar", 3, 3, 3 }); #endregion this.UltraChart1.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.Composite; this.UltraChart1.DataSource = table; this.UltraChart1.DataBind(); this.UltraChart2.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.Composite; ChartArea area = new ChartArea(); this.UltraChart2.CompositeChart.ChartAreas.Add(area); AxisItem axisX = new AxisItem(); axisX.OrientationType = Infragistics.UltraChart.Shared.Styles.AxisNumber.X_Axis; axisX.DataType = Infragistics.UltraChart.Shared.Styles.AxisDataType.String; axisX.SetLabelAxisType = Infragistics.UltraChart.Core.Layers.SetLabelAxisType.ContinuousData; axisX.Labels.ItemFormatString = "<ITEM_LABEL>"; axisX.Labels.Orientation = TextOrientation.Horizontal; AxisItem axisY = new AxisItem(); axisY.OrientationType = AxisNumber.Y_Axis; axisY.DataType = AxisDataType.Numeric; axisY.Labels.ItemFormatString = "<DATA_VALUE>"; area.Axes.Add(axisX); area.Axes.Add(axisY); //?? NumericSeries series = new NumericSeries(); series.Label = "Serie1"; series.Data.DataSource = table; series.Data.LabelColumn = "Name"; //? series.Data.ValueColumn = "Value1"; //? this.UltraChart2.CompositeChart.Series.Add(series); ChartLayerAppearance stackedAreaLayer = new ChartLayerAppearance(); stackedAreaLayer.ChartType = ChartType.StackAreaChart; stackedAreaLayer.ChartArea = area; stackedAreaLayer.AxisX = axisX; stackedAreaLayer.AxisY = axisY; stackedAreaLayer.Series.Add(series); this.UltraChart2.CompositeChart.ChartLayers.Add(stackedAreaLayer);
try setting stackedAreaLayer.SwapRowsAndColumns = true
Thanks for the help but this did not solve my problem.
Any other suggestions?
http://imagebin.ca/view/XIsNtfN.html
i solved the Problem this way:
i create for each row of the SourceTable a NumericSeries... this NumericSeries ist databound to a DataTable... this Table is defined by two columns... the first column for the elements that i want to appear on the x-axis... (for each element a row) the second column holds the corresponding values...
Surely not the best way but it works.
But i have to other questions left:
1. How can i configure the position of the CompositeLegend? Only through the .Bounds Property?
2. is it possible two display a legend as a SINGLE row? so the elements are not top->down, instead left->right.... The only way i found out to achieve this behaviour is to limit the height of legend so that no more elements fit.
1: yes, and .BoundsMeasureType.
2: the only way is to limit the height.