I have a composite chart composed of scatter and line charts. The charts share the X axis but each one uses Y and Y2 axes respectively and both Y axes are numeric. I need a 2Dbar chart that shares the X axis with the above 2 and a string data type Y axis. Is this possible? Thanks much!
As long as the X axis is numeric, it can be shared between scatter and bar layers. Line layers typically use a string X axis, unless you're using a scatter layer that connects its points. So it sounds like what you're describing should work fine. But if it doesn't, can youi post some more info and/or a code snippet?
You are correct, I'm using two scatter charts one with lines and one without. Both my Y and Y2 are numeric which led me to ask if a third chart that is 2D bar can use the common X and a new Y3 string?
Here's a possible example. 2 chart areas, one with bar, one with scatter layers.
ultraChart1.ChartType = ChartType.Composite;
ChartArea area1 = new ChartArea();area1.Bounds = new Rectangle(0,0,100,52);area1.BoundsMeasureType = MeasureType.Percentage;area1.Border.Thickness = 0;ultraChart1.CompositeChart.ChartAreas.Add(area1);
ChartArea area2 = new ChartArea();area2.Bounds = new Rectangle(0,47,100,53);area2.BoundsMeasureType = MeasureType.Percentage;area2.Border.Thickness = 0;ultraChart1.CompositeChart.ChartAreas.Add(area2);
AxisItem xAxisBar = new AxisItem(ultraChart1,AxisNumber.X_Axis);xAxisBar.DataType = AxisDataType.Numeric;area1.Axes.Add(xAxisBar);
AxisItem xAxisScatter = new AxisItem(ultraChart1, AxisNumber.X_Axis);xAxisScatter.DataType = AxisDataType.Numeric;area2.Axes.Add(xAxisScatter);
AxisItem yAxisBar = new AxisItem(ultraChart1, AxisNumber.Y_Axis);yAxisBar.DataType = AxisDataType.String;yAxisBar.SetLabelAxisType = SetLabelAxisType.GroupBySeries;xAxisBar.Extent = 0;xAxisBar.Visible = false;area1.Axes.Add(yAxisBar);
AxisItem yAxisScatter = new AxisItem(ultraChart1,AxisNumber.Y_Axis);yAxisScatter.DataType = AxisDataType.Numeric;area2.Axes.Add(yAxisScatter);
ChartLayerAppearance barLayer = new ChartLayerAppearance();barLayer.ChartType = ChartType.BarChart;barLayer.ChartArea = area1;barLayer.AxisX = xAxisBar;barLayer.AxisY = yAxisBar;
NumericSeries barSeries = new NumericSeries();barSeries.Points.Add(new NumericDataPoint(2, "pt1", false));barSeries.Points.Add(new NumericDataPoint(1, "pt2", false));barSeries.Points.Add(new NumericDataPoint(3, "pt3", false));barLayer.Series.Add(barSeries);ultraChart1.CompositeChart.Series.Add(barSeries);ultraChart1.CompositeChart.ChartLayers.Add(barLayer);
ChartLayerAppearance scatterLayer = new ChartLayerAppearance();scatterLayer.ChartType = ChartType.ScatterChart;scatterLayer.ChartArea = area2;scatterLayer.AxisX = xAxisScatter;scatterLayer.AxisY = yAxisScatter;
XYSeries scatterSeries = new XYSeries();scatterSeries.Points.Add(new XYDataPoint(1, 0, "pt1", false));scatterSeries.Points.Add(new XYDataPoint(2, 3, "pt2", false));scatterSeries.Points.Add(new XYDataPoint(5, 4, "pt3", false));scatterLayer.Series.Add(scatterSeries);ultraChart1.CompositeChart.Series.Add(scatterSeries);ultraChart1.CompositeChart.ChartLayers.Add(scatterLayer);
Thanks Max, you're the best!
Now, is it possible to reverse the bar chart instead of it always starting at zero I need it to start at a certain point along X and ALWAYS end at the X rangemax. It's almost like flipping the chart along the x axis. Hope that makes sense :0
Unfortunately, that behavior isn't supported. You can write the entire bar layer in FillSceneGraph event any way you want. That's about the only workaround I can think of.
Max,
Is it possible to create a composite chart with two layers, one with line(or scatter) chart and the other with column chart(vertical bars). Both layers should use the same X-axis(which is a Timeaxis). Line chart uses Y-axis whereas the column chart uses Y2 axis.
The problem that we have encountered is that in composite chart, the column chart supports only String type for X-axis.
Thanks,
Rambabu.
Sorry, all our column charts have to use a string x axis. You would have to create 2 different x axes to display a column layer and a time-based line layer.
Not sure if there are plans to support this. I suggest sending an email to productmanager@infragistics.com to inquire about it.
Thanks Max.
Further search in the forums yielded http://news.infragistics.com/forums/p/22546/82634.aspx#82634 where you gave sample code as well.
The requirement here(to have time axis for bar/column/...) seems to be a common one. Are there any plans to support it directly, without having to workaround by creating two axes. Creating two axes is work, esp with the string axis not moving as smooth as time axis for moving data(ranges need to be set in sync with the time axis)