Hello,
Is there any way to rotate Box(Whisker chart) in Infragistic Win Forms UltraChart component so it would be horizontal?
Thanks in advance
Thanks a lot Dimitar, it was very helpfull!
Best regards.
Hi Oleksandr,
Thanks you for the reply.
Yes, when using the ColumnChart the Path for text primitives for the axis labels have null value. So if you want to move them to the left you can try to recognize them by getting all the axis labels and checking if the text primitive is contained inside those labels. You can use code like this in the FillSceneGraph:
var textPrims = e.SceneGraph.OfType<Text>().ToList();
foreach (var text in textPrims)
{
var xAxis = e.Grid["X"] as SetLabelAxis;
if (xAxis == null)
return;
var labels = new List<string>();
for (int i = 0; i < xAxis.ChartData.GetColumnCount(); i++)
labels.Add(xAxis.ChartData.GetColumnLabel(i).ToString());
}
if (labels.Contains(text.GetTextString()))
text.bounds.Offset(20, 15);
As for the drop lines you could again use the FillSceneGraph event and add line primitives for the drop lines. You need to get the X and Y axes and then use their Map methods in order to determine the coordinates of the drop lines.
I have attached a sample demonstrating how to add the drop lines. For it I used a normal scatter chart.
Please let me know if you have any additional questions.
Hello Dimitar,
you helped me a lot, many thanks! But one thing I didn't managed to do anyway. It is to move X Axis labels to the right in the Column Chart. I have tried margin, it didn't helped, or maybe I used it in the wrong way. Also tried solution that I have described in the previous post - same result.
And one more little thing. Is there a way to show drop-lines for data points on this kind of chart?
Thanks in advance!
Also here is my original sample in VS2010.
In order for the suggested approach to work you should use chart with equal height and width. Otherwise when the chart is rotated some of it will get cut off. As for your other questions:
1. You can use multiple approaches for this task. I would suggest using the Override property of the chart and to supply the PaintElements you want to use. The paint elements of the primitives control whether or not the primitives will have gradients. For more information on the Override property, please follow this link:
http://help.infragistics.com/Help/Doc/WinForms/2012.2/CLR4.0/HTML/Infragistics4.Win.UltraWinChart.v12.2~Infragistics.Win.UltraWinChart.UltraChart~Override.html
2. As for having the data values entirely inside or outside of the bars, you could use the HorizontalAlign property of the ChartTextAppearance object, which you use for displaying the values
3. As for the axis labels position, a more universal approach would be to use the padding property of the axis labels. For this you can use code like:
ultraChart1.Axis.X.Labels.Layout.Padding = 30;
I have attached a sample in VS2010 demonstrating these suggestions,