I have the column Chart It has few data..the graph bars are looks good .but If I have single data means the graph bar is too large and it's not looks good ...Any solution for this issue
Hello chn_cntbtt,
Thank you for posting in the community.
I know it`s been a while since you posteb but if you are still in need of assistance I would be glad to help.
What I can suggest for achieving your requirement is using the FillSceneGraph server side event of UltraChart. In this event the width of the bars could be set as such:
protected void UltraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e) { foreach (Primitive p in e.SceneGraph) { Box box = p as Box; if (box != null && box.Layer != null) { //set the width of the bars box.rect.Width = 50; } } }
protected void UltraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e)
{
foreach (Primitive p in e.SceneGraph)
Box box = p as Box;
if (box != null && box.Layer != null)
//set the width of the bars
box.rect.Width = 50;
}
I also made a small sample illustrating my suggestion and I am attaching it for your reference.
Please let me know if you have any additional quetsions regardng this matter.
Hi Vasya,
Thanks for your solution.If i have single column bar the horizontal scroll bar should not come and also for 4 bars the space between the bars are too high.Could you Give idea on this issue
Hello chn_cntbbt,
Please do not hesitate to contact me if you need any further assistance with this matter, I would be glad to help.
Thank you for getting back to me.
In your scenario if you do not want to have the scrollbar appearing what I can suggest is turn off the scroll bar by setting the UltraChart`s EnableScrollBar property to false as such:
<igchart:UltraChart ID="UltraChart1" runat="server" EmptyChartText="Data Not Available. Please call UltraChart.Data.DataBind() after setting valid Data.DataSource" OnChartDataClicked="UltraChart1_ChartDataClicked" Version="13.1" BackgroundImageFileName="" OnFillSceneGraph="UltraChart1_FillSceneGraph" EnableScrollBar="False" >
When the scrollbar is enabled regardless of the width of each bar of the column chart UltraChart will zoom itself in order to fulfil the visible area and the rest of the axis (where there are no columns displayed) is not going to be visible but will still be there as part of the chart and that is the reason why the scrollbar appears.
Regarding your second requirement what I can recommend is using SeriesSpacing property of UltraChart. This property is used to set the spacing between the columns in a series in column width increments. Please keep in mind that if the width of the columns is set via the FillSceneGraphEvent the range of the X axis should be changed via it`s RangeMax and RangeMin properties in order to fulfil the empty space which is going to appear on the X axis if the series are displayed with no spacing between each other. For example:
<X Visible="True" TickmarkInterval="0" RangeMax="5" RangeMin="0" RangeType="Custom">
I am also attaching my modified sample for your reference.
Please feel free to contact me if you have any additional questions regarding this matter.