Hi Team,
I want to create a column chart and a line chat in the same chart area and these two charts should be plotted on the same primary X axis and primary Y axis. (like Google Combo chart)
In ColumnLine Chart, the column data are plotted on primary X axis and primary Y axis and the Line data are plotted on secondary X axis and secondary Y axis. (Ref: attached image)
What parameters do i need to set on ColumnLine chart to render a chart like Google Combo Chart?
(Ref: Google Combo Chart) https://google-developers.appspot.com/chart/interactive/docs/gallery/combochart
Thanks in advance
Hello,
Thank you for using our community.
What I would like to suggest you is using a composite chart. This chart type can be used to combine an infinite number of chart types. In our online documentation you can find step by step guidance how to create and use a composite chart. You can use the Chart wizard to help you faster develop the desired chart. Here are some useful references:
Creating a Composite Chart
About the Composite Chart
Composite Chart Data Series Types Sample
Composite Chart Layers Samples
Composite Chart Legends Sample
If you have further questions regarding this matter don’t hesitate to contact us.
Hi Marina,
Now I am able to create a combo chart but I don't know, how to render a legend inside the chart area (Ref: attached image).
.aspx
<igchart:UltraChart ID="igChart" runat="server" Width="700px" Height="550px"> </igchart:UltraChart>
.cs
CompositeLegend myLegend = new CompositeLegend(); myLegend.ChartLayers.Add(columnLayer); myLegend.ChartLayers.Add(lineLayer); myLegend.Bounds = new System.Drawing.Rectangle(0, 75, 20, 25); myLegend.BoundsMeasureType = MeasureType.Percentage; myLegend.PE.ElementType = PaintElementType.Gradient; myLegend.PE.FillGradientStyle = GradientStyle.ForwardDiagonal; myLegend.PE.Fill = Color.CornflowerBlue; myLegend.PE.FillStopColor = Color.Transparent; myLegend.Border.CornerRadius = 10; myLegend.Border.Thickness = 0; igChart.CompositeChart.Legends.Add(myLegend);
What is wrong in my code? How to render a legend inside a chart area with data points?
Hello CodeNinja,
Thank you for providing me your sample. If you set the SwapRowsAndColumns property to false (or just remove this property) the legend renders normally.
columnLayer.SwapRowsAndColumns = false;
The issue is caused because you group the columns into 5 groups of 2columns and you don’t provide labels for the legend to render. What I mean is that A, B, C ,D and E become group labels, but not column labels and that is why the legend doesn’t show anything. It needs label for the separate points.
If you have further questions, don’t hesitate to contact me.
Thanks for your idea!
But, I need to group the columns based on points(A,B,C,D,E) as well as i want to display legend.
Please refer the attached image.
How can i do this in infragistics chart control?
To accomplish this, you have to set a label for the different series and then when you use the swap option you will have both a legend that shows the series label and columns that are grouped. I updated your sample, please take a look at it and let me know how it works for you.
Thanks for your sample code.
The sample code what you attached creates a chart with series names on both chart X-axis as well as legend.
But, I need series names only on my legend, I don't like to display the series names on chart X-axis(because i feel, its redundant).
Is there any way to hide highlighted X-axis series names on composite chart?(Ref: attached image)
--SJ
Hello SJ,
If you set label visibility option of the column X axis to false it will hide the X-axis series names. Just add the following line:
columnXAxis.Labels.Visible = false;