I'm trying creating a Heatmap chart and I am using a DataChart with a CustomSeries.
I overrido the RenderSeriesOverride method, and provided my own rendering for the heatmap. This works great when my rows and columns are all numeric, as with NumericXAxis, I can calculate the value on the canvas by doing:
double scaledXCoord = XAxis.GetScaledValue(myDataPoint.MyIntValue, params);
and plot by heatmap square on the grid at the desired coordinate.
However, my data is not numeric, and I'd like to use Category, where my axis (rows and colums) are textual values. By default, the Axis figure out which labels go where, but the CategoryXAxis doesn't seem to give me a method where I can find out to what coordinate on the grid the label falls, so I can figure out where I should map my squares to.
In other words, what I'd like to do is be able to pass a string, and get the coordinate on the grid based on where the string matches the label on the axisdouble scaledXCoord = XAxis.GetScaledValue(myDataPoint.MyTextValue, params);
How can I do this?
Thanks
Hello,
I can suggest you use our WinForms HeatMap and integrate it in your WPF application. Here you can read more about this control:
http://help.infragistics.com/Help/NetAdvantage/WinForms/2012.1/CLR2.0/HTML/Chart_Working_with_2D_Heat_Map_Chart_Data.html
and here you can read how to import WinForms controls in WPF:
http://msdn.microsoft.com/en-us/library/ms751761.aspx
Hope this helps you.
I just want to note that I'm evaluating the Free Trial chart to do this. If what I have in the picture above is doable, my team will buy 4 developer licences for it next week. Any additional support you can offer would be great. Thanks!
I have gotten around the above problem by creating a custom mapping of the coordinates based on their index, and providing a custom function to resolve the datapoints based on their property values that match the current labels.
I'd still like to know if there is a better way to do this. How do the bar charts do it?
Also, how can I center my labels like in the bar chart, and not have them appear at the tick marks?
Here is a picture of what I'm trying to do:
I have data points:
[A, 1][B, 2][B, 3][C, 4]
Items source is set to my collection of datapoints, and I'd like the chart to show the following:
Hi Stefan,
The arguments of those functions take a double. This is precisely my problem. Since my data is label based, I don't have a double value. When I set the CategoryXAxis.ItemsSource, the collection contains only string values, and I need to match those string values to my data.
For example:
My chart consists of the following axis:
XAxis : red, yellow, greenYAxis : orange, pear, apple
apple |pear |orange |_______________________
red yellow green
My datapoints are:
{ red, apple }{ yellow, pear }{ green, orange }
The resulting plot should be:
apple | Xpear | Xorange |_________________X_____
Now to plot { red, apple }, I somehow need to resolve red to a coordinate of the grid. When I initially passed in my values to the CategoryXAxis [red, yellow, green], somehow they got plotted on coordinates 0, 1, and 2.
So how do I get the coordinate of where { red, apple } goes? I can't pass in XAxis.GetScaledValue(red, params), as it is not a double.
How did the CategoryXAxis figure out where red should be in the first place? Shouldn't I have some value mapping function that will match my data type to where it belongs? Clearly the other grids can somehow do this.
You can use the CategoryXAxis GetUnscaledValue or GetScaledValue method in in order to ge tteh coordonates of the specified value. Here you can read morea bout these methods:
http://help.infragistics.com/NetAdvantage/WPF/2012.2/CLR4.0/?page=InfragisticsWPF4.Controls.Charts.XamDataChart.v12.2~Infragistics.Controls.Charts.CategoryXAxis~GetUnscaledValue(Double,ScalerParams).html
http://help.infragistics.com/NetAdvantage/WPF/2012.2/CLR4.0/?page=InfragisticsWPF4.Controls.Charts.XamDataChart.v12.2~Infragistics.Controls.Charts.CategoryXAxis~GetScaledValue(Double,ScalerParams).html