Hello,
I have a question regarding histogram chart. The thing is that I already have a histogram data and I don't want to provide whole data set to calculate values on Y axis.
What I need is to show columns that on X axis will be measured with range values (like HistogramChart.ColumnAppearance.StringAxis = false), and on Y axis I just want to set my custom value for particular column.
Is it possible?
Thanks in advance
You can create a custom RangeType and specify a RangeMax and RangeMin as the start and end points for your height measurements along the X axis. For more details please visit our documentation Working with Histogram Chart Data. Let me know if you have any questions.
eg. this.ultraChart1.Axis.X.RangeMin = 0; this.ultraChart1.Axis.X.RangeMax = 20; this.ultraChart1.Axis.X.RangeType = AxisRangeType.Custom;
this.ultraChart1.Axis.X.RangeMin = 0; this.ultraChart1.Axis.X.RangeMax = 20; this.ultraChart1.Axis.X.RangeType = AxisRangeType.Custom;
this
No, on X axis I have everything I need, the problem is that I can't set my custom values for Y axis for Histogram chart. I just don't want that histogram chart calculate Y axis basing on count of repeatable data in data set. Just want to set my custom value for particular column.
The range I provided for xAxis can be applied to the yAxis too.
Can you please clarify the following: "want to set my custom value for particular column."
I have following data for chart:
public class HistogramChartItemInfo { private readonly Info _info; private readonly object _maxValue; private readonly object _minValue;
public HistogramChartItemInfo(Info info, object maxValue, object minValue) { _info = info; _maxValue = maxValue; _minValue = minValue; }
public Info Info { get { return _info; } } public object MaxValue { get { return _maxValue; } } public object MinValue { get { return _minValue; } } }
public struct Info { public long Count { get; private set; } public decimal? Percent { get; private set; }
public Info(long count, decimal? percent) { Count = count; Percent = percent; }
}
List<HistogramChartItemInfo> data = new List<HistogramChartItemInfo>();
and then for each data element I want to build column on histogram chart. X axis will display Min and Max value of HistogramChartItemInfo for each column, and the Y axis will display Count value of HistogramChartItemInfo.Info. So Max value for Y axis should be max value of data[i].HistogramChartItemInfo.Count (where "i" is the element with the max value of "Count" property).
If it is possible please attach sample solution.
Thanks!
Thank you your update, but I still do not quite understand. Can you please provide a mockup of your requirement?
The Y-Axis for a Histogram chart is to show the amount of items based on the certain set of range you have displayed.
Have you looked into using another ChartType, perhaps the ColumnChart?
"The Y-Axis for a Histogram chart is to show the amount of items based on the certain set of range you have displayed." - what I want from histogram is to show amount of items on Y axis provided by myself using just a parameter and not provide whole set of values (basically it is what column chart does as you said).
The column chart works fine for me except on X axis I want to show values on the borders of columns not in the middle (this behavior is on histogram chart when I set HistogramChart.ColumnAppearance.StringAxis = false).
So what I need is to set height of column just with the parameter (Like column chart) and set range of parameters for X axis (like histogram chart with StringAxis = false parameter).
So I have for each column following set of parameters:
X axis: min value and max value
Y axis: amount of items
Thanks.
I attached a sample that achieves your requirements.
1. You should be able to set the RangeMax for the Yaxis to be the count of items in your datasource. eg.
this.ultraChart1.Axis.Y.RangeMax = intArray.Count();
2. In order to set the range to be on the Xaxis and have them displayed horizontal you can create a class that implements IRenderLabel and customize the labels that way. Then you can set the Orientation property to Horizontal
eg. //Rotate the labels this.ultraChart1.Axis.X.Labels.Orientation = TextOrientation.Horizontal;
...FormLoad
this.ultraChart1.Axis.X.Labels.ItemFormatString = "<MY_VALUE>"; Hashtable MyLabelHashTable = new Hashtable(); MyLabelHashTable.Add("MY_VALUE", new MyLabelRenderer()); this.ultraChart1.LabelHash = MyLabelHashTable;
...end
public class MyLabelRenderer : IRenderLabel { public string ToString(Hashtable context) { double dataValue = (double)context["DATA_VALUE"]; if (dataValue == 20) return "20-25"; else if (dataValue == 15) return "15-20"; else if (dataValue == 10) return "10-15"; else if (dataValue == 5) return "5-10"; else return "0-5"; } }
For more details about this interface, please visit our documentation page: http://help.infragistics.com/doc/WinForms/2014.2/CLR4.0/?page=Chart_Customize_Labels_Using_the_IRenderLabel_Interface.html
Another chart type won't be necessary if you choose to use this implementation.
Let me know if you have any questions.
Unfortunately it is not what I meant. The X axis in original histogram works fine for me, the problem is with Y axis. In your sample the height of columns will be calculated based on amount of same values in array { 1, 9, 13, 5, 6, 7, 8, 9, 9, 9, 12, 13, 14, 15, 16 }; For example "9" digit is present 4 times. But in my data I already have the amount of particular values and
I just want to provide for example value=9; count=4; and get the result on Y axis as if I provided "9" digit four times in array.
P.S. I have VS 2010 and can't open your attachment
Hello Oleksandr,
I converted and attached a VS 2010 sample project.
I have opened a private case for you so we can continue our discussion. There I will be requesting for additional information. The case number is CAS-145768-T7L2Z0. You will see it located here: https://www.infragistics.com/my-account/support-activity
If you have any questions please update your case.