This example shows how to build a heat map that visualizes data in the form of a wafer chart.

| Language: C# |
using Nevron.Nov;
using Nevron.Nov.Chart;
using Nevron.Nov.Dom;
using Nevron.Nov.Graphics;
using Nevron.Nov.Layout;
using Nevron.Nov.UI;
using Nevron.Nov.Windows.Forms;
using System;
using System.Windows.Forms;
namespace NovWinFormsProject
{
public partial class Form1 : Form
{
#region Constructors
public Form1()
{
InitializeComponent();
// Set form title
Text = "NOV WinForms - NWaferChartExample";
// Create the NOV example and its controls
NWidget exampleContent = CreateExampleContent();
NWidget exampleControls = CreateExampleControls();
if (exampleControls != null)
{
exampleControls.PreferredWidth = 300;
}
// Place the example and its controls in a pair box
NPairBox pairBox = new NPairBox(exampleContent, exampleControls);
pairBox.FillMode = ENStackFillMode.First;
pairBox.FitMode = ENStackFitMode.First;
pairBox.Margins = new NMargins(NDesign.HorizontalSpacing, NDesign.VerticalSpacing);
// Host the example in the form
NNovWidgetHost host = new NNovWidgetHost(pairBox);
host.Dock = DockStyle.Fill;
Controls.Add(host);
}
#endregion
#region Example
public NWidget CreateExampleContent()
{
NChartViewWithCommandBars chartViewWithCommandBars = new NChartViewWithCommandBars();
NChartView chartView = chartViewWithCommandBars.View;
chartView.Surface.CreatePredefinedChart(ENPredefinedChartType.Cartesian);
// configure title
chartView.Surface.Titles[0].Text = "Standard Heat Maps";
// configure chart
NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];
chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear);
NHeatMapSeries heatMap = new NHeatMapSeries();
chart.Series.Add(heatMap);
NHeatMapData data = heatMap.Data;
heatMap.Palette = new NTwoColorPalette(NColor.Green, NColor.Red);
int gridSizeX = 100;
int gridSizeY = 100;
data.Size = new NSizeI(gridSizeX, gridSizeY);
int centerX = gridSizeX / 2;
int centerY = gridSizeY / 2;
int radius = gridSizeX / 2;
Random rand = new Random();
for (int y = 0; y < gridSizeY; y++)
{
for (int x = 0; x < gridSizeX; x++)
{
int dx = x - centerX;
int dy = y - centerY;
double pointDistance = Math.Sqrt(dx * dx + dy * dy);
if (pointDistance < radius)
{
// assign value
data.SetValue(x, y, pointDistance + rand.Next(20));
}
else
{
data.SetValue(x, y, double.NaN);
}
}
}
return chartViewWithCommandBars;
}
public NWidget CreateExampleControls()
{
NStackPanel stack = new NStackPanel();
NUniSizeBoxGroup boxGroup = new NUniSizeBoxGroup(stack);
return boxGroup;
}
public string GetExampleDescription()
{
return @"This example shows how to build a heat map that visualizes data in the form of a wafer chart.
";
}
///
/// Gets the relevant documentation links for the example
///
///
public (string Name, string Url)[] GetDocumentationUrls()
{
return new[]
{
("Heat Map Series", "https://www.nevron.com/docs/openvision/heat-map-chart-series.html"),
("Common Series Functionality", "https://www.nevron.com/docs/openvision/chart-common-series-functionality.html"),
("chart-palettes", "https://www.nevron.com/docs/openvision/chart-palettes.html"),
("Overview", "https://www.nevron.com/docs/openvision/chart-legeng-overview.html"),
};
}
#endregion
#region Implementation
#endregion
#region Event Handlers
#endregion
#region Fields
#endregion
#region Static Methods
#endregion
#region Constants
#endregion
#region Nested Types
#endregion
}
} | Language: VB.NET |
Imports Nevron.Nov
Imports Nevron.Nov.Chart
Imports Nevron.Nov.Dom
Imports Nevron.Nov.Graphics
Imports Nevron.Nov.Layout
Imports Nevron.Nov.UI
Imports Nevron.Nov.Windows.Wpf
Imports System
Class MainWindow
#Region "Constructors"
Public Sub New()
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
' Set form title
Title = "NOV WPF - NWaferChartExample"
' Create the NOV example and its controls
Dim exampleContent As NWidget = CreateExampleContent()
Dim exampleControls As NWidget = CreateExampleControls()
If Not exampleControls Is Nothing Then
exampleControls.PreferredWidth = 300
End If
' Place the example and its controls in a pair box
Dim pairBox As NPairBox = New NPairBox(exampleContent, exampleControls)
pairBox.FillMode = ENStackFillMode.First
pairBox.FitMode = ENStackFitMode.First
pairBox.Margins = New NMargins(NDesign.HorizontalSpacing, NDesign.VerticalSpacing)
' Host the example in the form
Dim host As NNovWidgetHost(Of NWidget) = New NNovWidgetHost(Of NWidget)(pairBox)
Content = host
End Sub
#End Region
#Region "Example"
Public Function CreateExampleContent() As NWidget
Dim chartViewWithCommandBars As NChartViewWithCommandBars = New NChartViewWithCommandBars()
Dim chartView = chartViewWithCommandBars.View
chartView.Surface.CreatePredefinedChart(ENPredefinedChartType.Cartesian)
' configure title
chartView.Surface.Titles(0).Text = "Standard Heat Maps"
' configure chart
Dim chart = CType(chartView.Surface.Charts(0), NCartesianChart)
chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear)
Dim heatMap As NHeatMapSeries = New NHeatMapSeries()
chart.Series.Add(heatMap)
Dim data = heatMap.Data
heatMap.Palette = New NTwoColorPalette(NColor.Green, NColor.Red)
Dim gridSizeX = 100
Dim gridSizeY = 100
data.Size = New NSizeI(gridSizeX, gridSizeY)
Dim centerX As Integer = gridSizeX / 2
Dim centerY As Integer = gridSizeY / 2
Dim radius As Integer = gridSizeX / 2
Dim rand As Random = New Random()
For y = 0 To gridSizeY - 1
For x = 0 To gridSizeX - 1
Dim dx = x - centerX
Dim dy = y - centerY
Dim pointDistance = Math.Sqrt(dx * dx + dy * dy)
If pointDistance < radius Then
' assign value
data.SetValue(x, y, pointDistance + rand.Next(20))
Else
data.SetValue(x, y, Double.NaN)
End If
Next
Next
Return chartViewWithCommandBars
End Function
Public Function CreateExampleControls() As NWidget
Dim stack As NStackPanel = New NStackPanel()
Dim boxGroup As NUniSizeBoxGroup = New NUniSizeBoxGroup(stack)
Return boxGroup
End Function
Public Function GetExampleDescription() As String
Return "This example shows how to build a heat map that visualizes data in the form of a wafer chart.
"
End Function
'''
''' Gets the relevant documentation links for the example
'''
'''
Public Function GetDocumentationUrls() As (String, String)()
Return {("Heat Map Series", "https://www.nevron.com/docs/openvision/heat-map-chart-series.html"), ("Common Series Functionality", "https://www.nevron.com/docs/openvision/chart-common-series-functionality.html"), ("chart-palettes", "https://www.nevron.com/docs/openvision/chart-palettes.html"), ("Overview", "https://www.nevron.com/docs/openvision/chart-legeng-overview.html")}
End Function
#End Region
#Region "Implementation"
#End Region
#Region "Event Handlers"
#End Region
#Region "Fields"
#End Region
#Region "Static Methods"
#End Region
#Region "Constants"
#End Region
#Region "Nested Types"
#End Region
End Class