Hi
I am using the column chart to display the graph and the bar width depends on the number of rows in the data table.
For example, if the datatable contains only two rows, then the two bar appears in the chart and each bar occupies 50% of the chart area. If there are four rows, then each bar occupies 25% of the chart area.
I would like to use a constant bar width instead of variant width based on the number of records. Can I set the bar width?. Can you show me an example?
Regards, Karthik
Hello Karthik,
It sounds like you are using the StackColumnChart. To override it either run the chartWizzard and select ColumnChart or set the ChartType in the Form :Loaded event like so:
ultraChart1.ChartType = Infragistics.UltraChart.Shared.Styles.
ChartType.ColumnChart;
Sincerely,
Petar Monov
Developer Support Engineer,
Infragistics, Inc
Petar,
Thanks for the response.
I don’t think, the issue is in selecting the chart type and I have mentioned rows instead of columns in my post that might have caused this confusion.
Please refer the attached word document.
In the code snippet you sent me you have only ONE row and and by default the dataPoints in the chart are constructed according to the number of rows thus you have only one datapoint which was ment to stick together the different lines.
In order to display smth like that:
you should either create use:
ultraChart1.Data.SwapRowsAndColumns = true;
or even better use a dataTable with one Column and 5 rows.
And there is a property you can in your scenario
ultraChart1.ColumnChart.ColumnSpacing = 1;
Hope this helps.
Regards Petar.
I m using your code but its not work in my chart.so any other option to set the chart column spacing..
Thanks for the quick response.
I will try the events and let you know, if I have any questions.
this behavior is not available as a feature of the chart.
however, you can manually change the widths of Box primitives prior to rendering, by handling the ChartDrawItem and/or FillSceneGraph events.
Is there any answers for my request.
Or can I assume, this is not possible in Ingragistics Chart?
I don't think, the solution is in swapping columns or setting the column spacing.
Let me know explain bit further based on the word document, I have sent.
The chart area width is around 700 pixels and as you can see in the first graph (with two bars), the two bars occupies the whole chart area. Each bar width is around 330 pixels.
In the second chart(four bars), each bar width is around 165 pixels.
The bar width varies depending on number of columns (or rows, if you swap it) and instead, I would like to set the bar width as 100 pixel, regarless of the number of columns (or rows).
Is this possible?