Blog

Introducing Heat Plots and Contours

Visiblox 3.0 contains a number of new series types, two of which are HeatPlotSeries and RasterContourSeries.  We'll explore how to use them in this blog post. 

For completeness, we've included a class diagram relating the new series types below.  You'll notice the DiscreteHeatPlotSeries doesn't feature in this post - we plan to write a separate blog post about that soon.  In both class diagrams in this post, partial classes have been represented as two separate but adjacent boxes. 

 SeriesClassDiagram

The main difference between these new series and the existing ones is in the DataSeries being plotted and the need for a third axis to plot against. 

DataSeries3D

Both of our new series use DataSeries3D<TX, TY, TZ> rather than DataSeries<TX, TY>.  DataSeries3D is very similar to DataSeries except that DataPoint3D<TX, TY, TZ> is used whereever you might expect DataPoint<TX, TY> in DataSeries.  Comparison delegates that use the Z value have been added to DataPointComparison - CompareByZ and CompareByXThenYThenZ. 

Logical Axes

We need some way of translating the Z value of each data into something that can be rendered - ILogicalAxis handles that mapping and the two existing implementations map to Color or contour height.  The ZAxis isn't represented by a FrameworkElement like other axes but does share some concepts such as Range and Zoom.

Both of the series can modify the Range of their ZAxis, given the Z values of the currently visible data points.  This should mean that there will always be a sensible number of contours visible and that Heat Plots always use their entire range of colours. 

Here's a class diagram relating the new axes:

AxesClassDiagram

Contours

Contour plots in Visiblox are highly configureable - amongst the aspects you can control are:

  • Contours can be either minor or major, each have separate styling and visibility settings
  • The auto-computed spacing between contours can be overridden with MajorInterval and MinorInterval
  • For even closer control, the methods SelectColourForZValue and SelectThicknessForZValue can be overridden and so arbitrary colours and line thicknesses can be used, depending on z-value, current selection and highlighting state and whether the contour is major or minor. 
  • If you're feeling especially adventurous you could use your own contour rendering algorithm by writing your own implementation of IContourRenderer

HeatPlot

A number of aspects of a heat plot can be configured:

  • The dimensions of each spot can be modified with the SpotRadiusX and SpotRadiusY properties
  • The Opacity of each spot decreases as you go from the centre out to the edge.  The rate at which that happens is determined by the FeatheringFactor.  This varies from 0 to 1 - a FeatheringFactor of 1 will give you a solid spot. 
  • The palette of colours used is determined by the ColorAxis.  The ColorMap property on the axis defaults to a DefaultColorMap instance and setting the ColorMapName property there allows you to choose between the palettes listed in the PredefinedColorMap enum. 
  • The interface for IColorMap has been kept simple so if none of those color maps are satisfactory then you can just write your own IColorMap implementation. 

Example

 Here's an example combining both series types - it plots temperature readings measured at various weather stations in Hawaii alongside a contour maps of the islands.  Hold down Shift to enable zooming, Ctrl to enable panning. 

You can download source code for the example here - you'll need to drop in an Ultimate edition Visiblox Charts dll, either purchased or from your trial to be able to compile it. 

 

Post a comment