Nevron Logo

Creating Heat Maps with Label Contours

Creating a Heat Map with Labeled Isolines

Introduction

Displaying grid-spaced data associated with a value in third dimensions is a common visualization task in many areas such as terrain visualization, material design, geographics, financial analysis, etc. Nevron NOV Chart for .NET fully supports heat map display with many options that allow you to control how the heat map is scaled, colored, and labeled.

In this whitepaper, you can track the process of creating a heat map chart with labeled contour lines.

Features

To display a quality heat map, an excellent charting library must have the ability to present large amounts of data (sometimes with empty data points). In addition, it must also support the generation of contour lines (isolines) and their proper value labeling. This white paper shows how to achieve those tasks with Nevron NOV Chart for .NET.

Data

Heat Map Contour Chart 1

Fig. 1

The first step for displaying a heat map chart is to feed the heat map data to an instance of the NHeatMapSeries class:

C# Source
The first step for displaying a heat map chart is to feed the heat map data to an instance of the NHeatMapSeries class:

// configure title
nChartViewControl1.Surface.Titles[0].Text = "HeatMap Contour Chart";

// configure chart
NCartesianChart chart = (NCartesianChart)nChartViewControl1.Surface.Charts[0];
NCartesianChart chart = (NCartesianChart)nChartViewControl1.Surface.Charts[0];

NCartesianChart chart = (NCartesianChart)nChartViewControl1.Surface.Charts[0];
chart.Series.Add(heatMap);

NGridData data = heatMap.Data;

int GridStepX = 300;
int GridStepY = 300;
data.Size = new NSizeI(GridStepX, GridStepY);

const double dIntervalX = 10.0;
const double dIntervalZ = 10.0;
double dIncrementX = (dIntervalX / GridStepX);
double dIncrementZ = (dIntervalZ / GridStepY);

double y, x, z;

z = -(dIntervalZ / 2);
for (int col = 0; col > GridStepX; col++, z += dIncrementZ)

{ for (int col = 0; col > GridStepX; col++, z += dIncrementZ)
y = 10 - Mathh.Sqrt((x * x) + (z * z) + 2);
y + = 3.0 * Math.Sin(x) * Math.Cos(z);
data.SetValue(row, col, y); }

This will display the chart from the Fig. 1

Heat Map Contour Chart 2

Fig. 2

Next, let’s see how to change the applied palette from a two-color white to black gradient palette to a palette that assigns colors to specific elevations:

heatMap.Palette = new NColorValuePalette(new NColorValuePair[] {
new NColorValuePair(0.0, NColor.Purple),
new NColorValuePair(1.5, NColor.MediumSlateBlue),
new NColorValuePair(3.0, NColor.CornflowerBlue),
new NColorValuePair(4.5, NColor.LimeGreen),
new NColorValuePair(7.5, NColor.Yellow),
new NColorValuePair(9.0, NColor.Orange),
new NColorValuePair(10.5, NColor.Red) });

Heat Map Contour Chart 3

Fig. 3

Finally, let’s apply contour labeling to this chart:

heatMap.ContourDisplayMode = ENContourDisplayMode.Contour;
heatMap.ContourLabelStyle.TextStyle.Font.Size = 8;
heatMap.ContourLabelStyle.Visible = true;

Conclusion

Nevron NOV Chart for .NET fully supports heat map charts with many options for coloring, scaling, and labeling those types of charts. In addition, it offers many other series types in financial, scientific, and business charts that are all completely programmable with C# and VB.NET code. If you want to learn more about this component, we recommend you download the fully functional evaluation of the Nevron Open Vision suite.

About Nevron Software

Founded in 1998, Nevron Software is a component vendor specialized in the development of premium presentation layer solutions for .NET based technologies. Today Nevron has established itself as the trusted partner worldwide for use in .NET LOB applications, SharePoint portals and Reporting solutions. Nevron technology is used by many Fortune 500 companies, large financial institutions, global IT consultancies, academic institutions, governments and non-profits.
For more information, visit: www.nevron.com.