Hi,
I am using composite chart to display the chart types like Line, Scatter, Area and Bar chart. In my code, the Line and Scatter charts are working fine. But the Area and Bar charts are not appearing in the composite chart. Could you please suggest me the right steps to follow in displaying the Area and Bar charts in the composite chart?
Note: I have reffered the Axis Requirements in the Infragistics online help, they suggesting to use the following requirements for composite chart...
Area (2D)
Both:
AxisDataType=String/Time
and
SetLabelAxisType=Continuous
AxisDataType=Numeric
n/a
Bar (2D)
AxisDataType=String
SetLabelAxisType=GroupBySeries
But in my requirement, I need to use "X-axis as Time/Numeric" & "Y-axis as Numeric" for both Area and Bar chart. Please suggest me a solution.
Thanks & Regards,
Raaj
My requirement is very urgent. Could anyone suggest me solution or provide sample codes?
Regards,
Hi Raaj,
Did you have a time to take a look at my sample, that Boris upload yesterday in this forum thread http://community.infragistics.com/forums/p/68189/345467.aspx If so there is shown how to used AreaChart.
Right now I made small modification to combine Line, Area and ColumBar chart. Please take a look at the attached sample and let me know if you have any questions.
Regards
Hi Dave,
I will provide you sample screen shots for the BAR and AREA chart taken from the DevXpress chart.
I am using the Ultra chart with type composite chart to display BAR and AREA charts in ultra chart.
Sample BAR chart with X-axis(Date) and Y-axis(Numeric):
Sample BAR chart with X-axis(Numeric) and Y-axis(Numeric):
Sample AREA chart with X-axis(Date) and Y-axis(Numeric):
Sample AREA chart with X-axis(Numeric) and Y-axis(Numeric):
To bind the values, I have using the below codes.
NumericSeries NumSeries = new NumericSeries(); NumSeries.Data.LabelColumn = xMemberData.ToString(); NumSeries.Data.ValueColumn = yMemberData.ToString(); NumSeries.Data.DataSource = dtTemp; NumSeries.DataBind(); series = NumSeries;
NumericSeries
NumSeries = new NumericSeries();
NumSeries.Data.LabelColumn = xMemberData.ToString();
NumSeries.Data.ValueColumn = yMemberData.ToString();
NumSeries.Data.DataSource = dtTemp;
NumSeries.DataBind();
series = NumSeries;
And to bind the series with the composite chart, I will be using the below codes..
chartPreview.ChartType =
ChartType.Composite;
chartPreview.CompositeChart.ChartAreas.Add(area1);
// AxisItem x2 = new AxisItem(chartPreview, AxisNumber.X2_Axis);
//*** for Y1 Axes
{
layerY1 =
new ChartLayerAppearance(chartPreview); layerY1.Key = graph.AxisY1Variables[Y1].Name.ToString(); layerY1.ChartType = UpdateSeries(graph.AxisY1Variables[Y1].SeriesType.ToString()); LayerY1Collection.Add(layerY1); } }
layerY1.Key = graph.AxisY1Variables[Y1].Name.ToString();
layerY1.ChartType = UpdateSeries(graph.AxisY1Variables[Y1].SeriesType.ToString());
LayerY1Collection.Add(layerY1);
}
//*** for Y2 Axes if (graph != null && nbgY2Axis.ItemLinks.Count != 0) { for (int Y2 = 0; Y2 < nbgY2Axis.ItemLinks.Count; Y2++) { layerY2 = new ChartLayerAppearance(chartPreview); layerY2.Key = graph.AxisY2Variables[Y2].Name.ToString(); layerY2.ChartType = UpdateSeries(graph.AxisY2Variables[Y2].SeriesType.ToString()); LayerY2Collection.Add(layerY2); } }
//*** for Y2 Axes
if (graph != null && nbgY2Axis.ItemLinks.Count != 0) {
for (int Y2 = 0; Y2 < nbgY2Axis.ItemLinks.Count; Y2++) { layerY2 =
layerY2 =
new ChartLayerAppearance(chartPreview); layerY2.Key = graph.AxisY2Variables[Y2].Name.ToString(); layerY2.ChartType = UpdateSeries(graph.AxisY2Variables[Y2].SeriesType.ToString()); LayerY2Collection.Add(layerY2); } }
layerY2.Key = graph.AxisY2Variables[Y2].Name.ToString();
layerY2.ChartType = UpdateSeries(graph.AxisY2Variables[Y2].SeriesType.ToString());
LayerY2Collection.Add(layerY2);
LayerY1Collection[Y11].ChartArea = area1; LayerY1Collection[Y11].AxisX = x; LayerY1Collection[Y11].AxisY = y;
LayerY1Collection[Y11].ChartArea = area1;
LayerY1Collection[Y11].AxisX = x;
LayerY1Collection[Y11].AxisY = y;
if
(area1.Axes.Count == 0) { area1.Axes.Add(x); area1.Axes.Add(y); } LayerY1Collection[Y11].AxisX.Extent = 75; LayerY1Collection[Y11].AxisY.Extent = 75;
area1.Axes.Add(x);
area1.Axes.Add(y);
LayerY1Collection[Y11].AxisX.Extent = 75;
LayerY1Collection[Y11].AxisY.Extent = 75;
//***** common settings for X-axis and Y-axis
LayerY1Collection[Y11].Visible = true; LayerY1Collection[Y11].AxisX.Visible =
LayerY1Collection[Y11].AxisX.Visible =
true; LayerY1Collection[Y11].AxisX.Labels.Visible = t
LayerY1Collection[Y11].AxisX.Labels.Visible = t
rue; LayerY1Collection[Y11].AxisX.ScrollScale.Visible = f
LayerY1Collection[Y11].AxisX.ScrollScale.Visible = f
alse; LayerY1Collection[Y11].AxisX.RangeType =
LayerY1Collection[Y11].AxisX.RangeType =
AxisRangeType.Automatic; LayerY1Collection[Y11].AxisX.TickmarkStyle =
LayerY1Collection[Y11].AxisX.TickmarkStyle =
AxisTickStyle.Smart; LayerY1Collection[Y11].AxisY.Visible =
LayerY1Collection[Y11].AxisY.Visible =
true; LayerY1Collection[Y11].AxisY.Labels.Visible = t
LayerY1Collection[Y11].AxisY.Labels.Visible = t
rue; LayerY1Collection[Y11].AxisY.ScrollScale.Visible = f
LayerY1Collection[Y11].AxisY.ScrollScale.Visible = f
alse; LayerY1Collection[Y11].AxisY.RangeType =
LayerY1Collection[Y11].AxisY.RangeType =
AxisRangeType.Automatic; LayerY1Collection[Y11].AxisY.TickmarkStyle =
LayerY1Collection[Y11].AxisY.TickmarkStyle =
AxisTickStyle.Smart;
//***** For Y1 Axis layer **************
if (LayerY1Collection[Y11].ChartType.ToString().Contains(SeriesType.Area.ToString())) { LayerY1Collection[Y11].ChartType =
LayerY1Collection[Y11].ChartType =
ChartType.AreaChart;
if (IsDateSeries) { x.DataType =
x.DataType =
AxisDataType.Time; y.DataType =
y.DataType =
AxisDataType.Numeric; x.SetLabelAxisType =
x.SetLabelAxisType =
SetLabelAxisType.ContinuousData; LayerY1Collection[Y11].AxisX.TickmarkIntervalType =
LayerY1Collection[Y11].AxisX.TickmarkIntervalType =
AxisIntervalType.Months; LayerY1Collection[Y11].AxisX.Labels.ItemFormat =
LayerY1Collection[Y11].AxisX.Labels.ItemFormat =
AxisItemLabelFormat.Custom; LayerY1Collection[Y11].AxisX.Labels.ItemFormatString =
LayerY1Collection[Y11].AxisX.Labels.ItemFormatString =
"<DATA_VALUE:MM/dd/yyyy>"; LayerY1Collection[Y11].AxisX.Labels.Orientation =
LayerY1Collection[Y11].AxisX.Labels.Orientation =
TextOrientation.Custom; LayerY1Collection[Y11].AxisX.Labels.OrientationAngle = -40; LayerY1Collection[Y11].AxisY.Labels.ItemFormat =
LayerY1Collection[Y11].AxisX.Labels.OrientationAngle = -40;
LayerY1Collection[Y11].AxisY.Labels.ItemFormat =
AxisItemLabelFormat.Custom; LayerY1Collection[Y11].AxisY.Labels.ItemFormatString =
LayerY1Collection[Y11].AxisY.Labels.ItemFormatString =
"<DATA_VALUE:00.0000>"; }
else
{ x.DataType =
AxisDataType.String; y.DataType =
SetLabelAxisType.ContinuousData;
LayerY1Collection[Y11].AxisX.Labels.Orientation = TextOrientation.VerticalLeftFacing;
LayerY1Collection[Y11].AxisX.Labels.ItemFormat = AxisItemLabelFormat.ItemLabel; LayerY1Collection[Y11].AxisY.Labels.ItemFormat =
AxisItemLabelFormat.DataValue; LayerY1Collection[Y11].AxisY.Labels.ItemFormatString =
"<DATA_VALUE:00.0000>"; } }
else if (LayerY1Collection[Y11].ChartType.ToString().Contains(SeriesType.Bar.ToString())) { LayerY1Collection[Y11].ChartType =
ChartType.BarChart;
AxisDataType.Numeric; y.DataType =
AxisDataType.String; y.SetLabelAxisType =
y.SetLabelAxisType =
SetLabelAxisType.GroupBySeries;
BarChartAppearance barAppearance = new BarChartAppearance(); barAppearance.NullHandling =
barAppearance.NullHandling =
NullHandling.Zero; barAppearance.BarSpacing = 1; LayerY1Collection[Y11].ChartTypeAppearance = barAppearance; LayerY1Collection[Y11].AxisX.TickmarkIntervalType =
barAppearance.BarSpacing = 1;
LayerY1Collection[Y11].ChartTypeAppearance = barAppearance;
AxisItemLabelFormat.ItemLabel; LayerY1Collection[Y11].AxisX.Labels.Orientation =
AxisItemLabelFormat.DataValue; }
AxisDataType.Numeric; y.DataType = A
y.DataType = A
xisDataType.String; y.SetLabelAxisType =
SetLabelAxisType.GroupBySeries; LayerY1Collection[Y11].AxisX.Labels.ItemFormat =
AxisItemLabelFormat.DataValue; LayerY1Collection[Y11].AxisX.Labels.ItemFormatString =
"<DATA_VALUE:00.0000>";
LayerY1Collection[Y11].AxisY.Labels.Orientation = TextOrientation.Custom; LayerY1Collection[Y11].AxisY.Labels.OrientationAngle = 0;
LayerY1Collection[Y11].AxisY.Labels.OrientationAngle = 0;
LayerY1Collection[Y11].AxisY.Labels.ItemFormat = AxisItemLabelFormat.ItemLabel;
BarChartAppearance barAppearance = new BarChartAppearance(chartPreview); barAppearance.NullHandling =
NullHandling.Zero; barAppearance.BarSpacing = 2; barAppearance.SeriesSpacing = 2;
barAppearance.BarSpacing = 2;
barAppearance.SeriesSpacing = 2;
LayerY1CollectioRaajn[Y11].ChartTypeAppearance = barAppearance; } }
Did you (or anyone from your team) find time to look into this issue?
Please let me know if you need any clarification regarding this issue.
Hello Raaj,
I made small sample for you where I`m using BarChart with AreaChart together with mentioned axis. Could you please take a look at the attached sample for more details and let me know if you have any questions.
PS. Could you please upload whole sample in forum thread (using Option Tab or Media button during replay ), because the code that you post is very difficult to be check it. Thanks !
Have you been able to resolve your issue ? Did you have a time to take a look at the attached sample. Feel free to write me if you have any questions.
I have gone through the samples that you have send. In that, You have mentioned NumericTimeSeries(X-axis as Date and Y-axis as Numeric) for AREA chart and NumericSeries(X-axis as Numeric & Y-axis as String) for BAR chart.
I know this will work very fine beacuse I already using these combinations.
But my problem is, I need to display
1. AREA chart with X-axis as Numeric and Y-axis as Numeric.
2. BAR chart with X-axis as Date and Y-axis as Numeric.
For these things, do I need to convert the Numeric/Date to String for binding in the NumericSeries???
If I convert the Date to String, or Numeric to String, does the chart axis labels appear fine in the axis label area???
Please refer the below mentioned screen shots for axis formats that I need to display for AREA and BAR chart. This screen shot is taken from the DevXpress chart control.
1 (a) Sample BAR chart with X-axis(Date) and Y-axis(Numeric):
1 (b) Sample BAR chart with X-axis(Numeric) and Y-axis(Numeric):
2 (a) Sample AREA chart with X-axis(Date) and Y-axis(Numeric):
2 (b) Sample AREA chart with X-axis(Numeric) and Y-axis(Numeric):
If we convert the Numeric to String for AREA chart X-axis, does the chart graph and its labels looks fine???
If you send samples for the above requirement, it will be greatly helpful for us.
If you take a look in our online documentetion : http://help.infragistics.com/Help/NetAdvantage/WinForms/2012.1/CLR2.0/html/Chart_Requirements_for_Series_Binding.html
you could find what kind of series is appropriate for each chart type. So mentioned behavior is expected.
Raaj said: But my problem is, I need to display 1. AREA chart with X-axis as Numeric and Y-axis as Numeric. 2. BAR chart with X-axis as Date and Y-axis as Numeric.
Maybe one possible way to achieve desired behavior could be if you handle FillSceneGraphe event and replace your lables with desired text. For example:
foreach (Primitive item in e.SceneGraph) { Text pl = item as Text; if (pl != null) { string temp = pl.GetTextString(); switch (temp) { case "1": pl.PE.Fill = Color.Crimson; pl.SetTextString("Jan"); …… } } }
foreach (Primitive item in e.SceneGraph)
Text pl = item as Text;
if (pl != null)
string temp = pl.GetTextString();
switch (temp)
case "1":
pl.PE.Fill = Color.Crimson;
pl.SetTextString("Jan");
……
Let me know if you have any questions.