private void GenerateData(NHeatMapSeries heatMap) { NHeatMapData data = heatMap.Data; int GridStepX = 300; int GridStepY = 300; data.SetGridSize(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) { x = -(dIntervalX / 2); for (int row = 0; row < GridStepY; row++, x += dIncrementX) { y = 10 - Math.Sqrt((x * x) + (z * z) + 2); y += 3.0 * Math.Sin(x) * Math.Cos(z); double value = y; data.SetValue(row, col, value); } } }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = new NLabel("Heat Map"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; // create the heat map (will be updated on timer tick) m_HeatMap = new NHeatMapSeries(); m_HeatMap.Data.SetGridSize(m_SizeX, m_SizeY); m_HeatMap.Data.SetValues(double.NaN); m_HeatMap.Legend.Mode = SeriesLegendMode.SeriesLogic; // used to display palette information m_HeatMap.Legend.PaletteLegendMode = PaletteLegendMode.GradientAxis; m_HeatMap.Legend.PaletteScaleStepMode = PaletteScaleStepMode.SynchronizeWithScaleConfigurator; m_HeatMap.Legend.PaletteLength = new NLength(400); NNumericScaleConfigurator numericScale = m_HeatMap.Legend.PaletteScaleConfigurator as NNumericScaleConfigurator; numericScale.MajorTickMode = MajorTickMode.CustomStep; numericScale.CustomStep = 10; m_HeatMap.Palette.Mode = PaletteMode.AutoMinMaxColor; m_HeatMap.Palette.PositiveColor = Color.FromArgb(125, Color.Red); m_HeatMap.Palette.ZeroColor = Color.FromArgb(125, Color.Blue); m_HeatMap.Palette.SmoothPalette = true; chart.Series.Add(m_HeatMap); // add background image NRangeSeries range = new NRangeSeries(); range.UseXValues = true; range.DataLabelStyle.Visible = false; range.Legend.Mode = SeriesLegendMode.None; range.Values.Add(0); range.Y2Values.Add(m_SizeY); range.XValues.Add(0); range.X2Values.Add(m_SizeX); Bitmap bitmap = NResourceHelper.BitmapFromResource(this.GetType(), "USMap.png", "Nevron.Examples.Chart.WinForm.Resources"); range.FillStyle = new NImageFillStyle(bitmap); chart.Series.Add(range); timer1.Interval = 100; timer1.Start(); ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = new NLabel("Heat Map Contour"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator(); // create the heat map m_HeatMap = new NHeatMapSeries(); chart.Series.Add(m_HeatMap); m_HeatMap.Palette.Add(0.0, Color.Purple); m_HeatMap.Palette.Add(1.5, Color.MediumSlateBlue); m_HeatMap.Palette.Add(3.0, Color.CornflowerBlue); m_HeatMap.Palette.Add(4.5, Color.LimeGreen); m_HeatMap.Palette.Add(6.0, Color.LightGreen); m_HeatMap.Palette.Add(7.5, Color.Yellow); m_HeatMap.Palette.Add(9.0, Color.Orange); m_HeatMap.Palette.Add(10.5, Color.Red); m_HeatMap.XValuesMode = HeatMapValuesMode.OriginAndStep; m_HeatMap.YValuesMode = HeatMapValuesMode.OriginAndStep; m_HeatMap.ContourDisplayMode = ContourDisplayMode.Contour; m_HeatMap.Legend.Mode = SeriesLegendMode.SeriesLogic; m_HeatMap.Legend.Format = "<zone_value>"; GenerateData(); ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]); // init form controls OriginXUpDown.Value = 0; OriginYUpDown.Value = 0; StepXUpDown.Value = 1; StepYUpDown.Value = 1; ContourDisplayModeCombo.FillFromEnum(typeof(ContourDisplayMode)); ContourColorModeCombo.FillFromEnum(typeof(ContourColorMode)); GridDisplayModeComboBox.FillFromEnum(typeof(HeatMapGridDisplayMode)); ContourDisplayModeCombo.SelectedIndex = (int)ContourDisplayMode.Contour; GridDisplayModeComboBox.SelectedIndex = (int)HeatMapGridDisplayMode.None; GridDotSizeNumericUpDown.Value = (decimal)2; ContourColorModeCombo.SelectedIndex = (int)ContourColorMode.Uniform; ContourDotSizeNumericUpDown.Value = (decimal)2; ShowFillCheckBox.Checked = true; SmoothPaletteCheckBox.Checked = true; }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = new NLabel("Wafer Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); // configure chart NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0]; m_HeatMap = new NHeatMapSeries(); chart.Series.Add(m_HeatMap); NHeatMapData data = m_HeatMap.Data; m_HeatMap.Palette.Mode = PaletteMode.AutoFixedEntryCount; m_HeatMap.Palette.AutoPaletteColors = new NArgbColorValue[] { new NArgbColorValue(Color.Green), new NArgbColorValue(Color.Red) }; m_HeatMap.Palette.SmoothPalette = true; int gridSizeX = 100; int gridSizeY = 100; data.SetGridSize(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); } } } }
/// <summary> /// /// </summary> /// <returns></returns> protected override NWidget CreateExampleContent() { NChartView chartView = CreateCartesianChartView(); // configure title chartView.Surface.Titles[0].Text = "Standard Heat Map"; // configure chart NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0]; chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear); m_HeatMap = new NHeatMapSeries(); chart.Series.Add(m_HeatMap); NGridData data = m_HeatMap.Data; m_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(6.0, NColor.LightGreen), new NColorValuePair(7.5, NColor.Yellow), new NColorValuePair(9.0, NColor.Orange), new NColorValuePair(10.5, NColor.Red) }); int gridSizeX = 100; int gridSizeY = 100; data.Size = new NSizeI(gridSizeX, gridSizeY); double y, x, z; const double dIntervalX = 10.0; const double dIntervalZ = 10.0; double dIncrementX = (dIntervalX / gridSizeX); double dIncrementZ = (dIntervalZ / gridSizeY); z = -(dIntervalZ / 2); for (int j = 0; j < gridSizeY; j++, z += dIncrementZ) { x = -(dIntervalX / 2); for (int i = 0; i < gridSizeX; i++, x += dIncrementX) { y = 10 - Math.Sqrt((x * x) + (z * z) + 2); y += 3.0 * Math.Sin(x) * Math.Cos(z); data.SetValue(i, j, y); } } return(chartView); }
/// <summary> /// /// </summary> /// <returns></returns> protected override NWidget CreateExampleContent() { NChartView chartView = CreateCartesianChartView(); // 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); NGridData 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(chartView); }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Panels.Clear(); // set a chart title NLabel title = new NLabel("Heat Map - Contour"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.DockMode = PanelDockMode.Top; title.Margins = new NMarginsL(0, 5, 0, 0); nChartControl1.Panels.Add(title); NCartesianChart chart = new NCartesianChart(); nChartControl1.Panels.Add(chart); chart.DockMode = PanelDockMode.Fill; chart.BoundsMode = BoundsMode.Stretch; chart.Margins = new NMarginsL(5); // create the heat map NHeatMapSeries heatMap = new NHeatMapSeries(); chart.Series.Add(heatMap); heatMap.Palette.Add(0.0, Color.Purple); heatMap.Palette.Add(1.5, Color.MediumSlateBlue); heatMap.Palette.Add(3.0, Color.CornflowerBlue); heatMap.Palette.Add(4.5, Color.LimeGreen); heatMap.Palette.Add(6.0, Color.LightGreen); heatMap.Palette.Add(7.5, Color.Yellow); heatMap.Palette.Add(9.0, Color.Orange); heatMap.Palette.Add(10.5, Color.Red); heatMap.XValuesMode = HeatMapValuesMode.OriginAndStep; heatMap.YValuesMode = HeatMapValuesMode.OriginAndStep; heatMap.ContourDisplayMode = ContourDisplayMode.Contour; heatMap.Legend.Mode = SeriesLegendMode.SeriesLogic; heatMap.Legend.Format = "<zone_value>"; GenerateData(heatMap); // update chart control from form controls heatMap.ContourLabelStyle.Visible = ShowContourLabelsCheckBox.Checked; heatMap.ContourLabelStyle.AllowLabelToFlip = AllowLabelsToFlipCheckBox.Checked; heatMap.ContourLabelStyle.TextStyle.BackplaneStyle.Visible = ShowLabelBackgroundCheckBox.Checked; heatMap.ContourLabelStyle.ClipContour = ClipContourCheckBox.Checked; }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { // set a chart title NLabel title = new NLabel("Heat Map Contour"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; // create the heat map m_HeatMap = new NHeatMapSeries(); chart.Series.Add(m_HeatMap); m_HeatMap.Palette.Add(0.0, Color.Purple); m_HeatMap.Palette.Add(1.5, Color.MediumSlateBlue); m_HeatMap.Palette.Add(3.0, Color.CornflowerBlue); m_HeatMap.Palette.Add(4.5, Color.LimeGreen); m_HeatMap.Palette.Add(6.0, Color.LightGreen); m_HeatMap.Palette.Add(7.5, Color.Yellow); m_HeatMap.Palette.Add(9.0, Color.Orange); m_HeatMap.Palette.Add(10.5, Color.Red); m_HeatMap.XValuesMode = HeatMapValuesMode.OriginAndStep; m_HeatMap.YValuesMode = HeatMapValuesMode.OriginAndStep; m_HeatMap.ContourDisplayMode = ContourDisplayMode.Contour; m_HeatMap.Legend.Mode = SeriesLegendMode.SeriesLogic; m_HeatMap.Legend.Format = "<zone_value>"; GenerateData(); ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]); // init form controls NExampleHelpers.FillComboWithEnumValues(ContourDisplayModeCombo, typeof(ContourDisplayMode)); NExampleHelpers.FillComboWithEnumValues(ContourColorModeCombo, typeof(ContourColorMode)); ContourDisplayModeCombo.SelectedIndex = (int)ContourDisplayMode.Contour; ContourColorModeCombo.SelectedIndex = (int)ContourColorMode.Uniform; ShowFillCheckBox.IsChecked = true; SmoothPaletteCheckBox.IsChecked = true; UpdateHeatMapSeries(); }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { // set a chart title NLabel title = new NLabel("Heat Map Contour"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator(); // create the heat map m_HeatMap = new NHeatMapSeries(); chart.Series.Add(m_HeatMap); m_HeatMap.Palette.Add(0.0, Color.Purple); m_HeatMap.Palette.Add(1.5, Color.MediumSlateBlue); m_HeatMap.Palette.Add(3.0, Color.CornflowerBlue); m_HeatMap.Palette.Add(4.5, Color.LimeGreen); m_HeatMap.Palette.Add(6.0, Color.LightGreen); m_HeatMap.Palette.Add(7.5, Color.Yellow); m_HeatMap.Palette.Add(9.0, Color.Orange); m_HeatMap.Palette.Add(10.5, Color.Red); m_HeatMap.Palette.SmoothPalette = true; m_HeatMap.XValuesMode = HeatMapValuesMode.OriginAndStep; m_HeatMap.YValuesMode = HeatMapValuesMode.OriginAndStep; m_HeatMap.ContourDisplayMode = ContourDisplayMode.Contour; m_HeatMap.Legend.Mode = SeriesLegendMode.SeriesLogic; m_HeatMap.Legend.Format = "<zone_value>"; m_HeatMap.ContourLabelStyle.Visible = true;; m_HeatMap.ContourLabelStyle.AllowLabelToFlip = false; m_HeatMap.ContourLabelStyle.TextStyle.BackplaneStyle.Visible = false; m_HeatMap.ContourLabelStyle.ClipContour = true; ShowContourLabelsCheckBox.IsChecked = true; AllowLabelsToFlipCheckBox.IsChecked = false; ShowLabelBackgroundCheckBox.IsChecked = false; ClipContourCheckBox.IsChecked = true; GenerateData(); ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]); }
/// <summary> /// /// </summary> /// <returns></returns> protected override NWidget CreateExampleContent() { NChartView chartView = CreateCartesianChartView(); // configure title chartView.Surface.Titles[0].Text = "Contour Chart"; // configure chart NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0]; chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear); m_HeatMap = new NHeatMapSeries(); chart.Series.Add(m_HeatMap); m_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(6.0, NColor.LightGreen), new NColorValuePair(7.5, NColor.Yellow), new NColorValuePair(9.0, NColor.Orange), new NColorValuePair(10.5, NColor.Red) }); /* m_HeatMap.Palette = new NColorValuePalette(new NColorValuePair[] { new NColorValuePair(-5.0, NColor.Purple), * new NColorValuePair(1, NColor.MediumSlateBlue), * new NColorValuePair(10.0, NColor.CornflowerBlue) });*/ m_HeatMap.ContourDisplayMode = ENContourDisplayMode.Contour; m_HeatMap.LegendView.Mode = ENSeriesLegendMode.SeriesLogic; m_HeatMap.LegendView.Format = "<level_value>"; GenerateData(); return(chartView); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumNames(ContourDisplayModeDropDownList, typeof(ContourDisplayMode)); WebExamplesUtilities.FillComboWithEnumNames(ContourColorModeDropDownList, typeof(ContourColorMode)); ShowFillCheckBox.Checked = true; SmoothPaletteCheckBox.Checked = true; ContourDisplayModeDropDownList.SelectedIndex = (int)ContourDisplayMode.Contour; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Panels.Clear(); // set a chart title NLabel title = new NLabel("Heat Map - Contour"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.DockMode = PanelDockMode.Top; title.Margins = new NMarginsL(0, 5, 0, 0); nChartControl1.Panels.Add(title); NLegend legend = new NLegend(); legend.DockMode = PanelDockMode.Right; legend.Margins = new NMarginsL(0, 5, 5, 0); legend.FitAlignment = ContentAlignment.TopCenter; nChartControl1.Panels.Add(legend); NCartesianChart chart = new NCartesianChart(); nChartControl1.Panels.Add(chart); chart.DisplayOnLegend = legend; chart.DockMode = PanelDockMode.Fill; chart.BoundsMode = BoundsMode.Stretch; chart.Margins = new NMarginsL(5); // create the heat map NHeatMapSeries heatMap = new NHeatMapSeries(); chart.Series.Add(heatMap); heatMap.Palette.Add(0.0, Color.Purple); heatMap.Palette.Add(1.5, Color.MediumSlateBlue); heatMap.Palette.Add(3.0, Color.CornflowerBlue); heatMap.Palette.Add(4.5, Color.LimeGreen); heatMap.Palette.Add(6.0, Color.LightGreen); heatMap.Palette.Add(7.5, Color.Yellow); heatMap.Palette.Add(9.0, Color.Orange); heatMap.Palette.Add(10.5, Color.Red); heatMap.XValuesMode = HeatMapValuesMode.OriginAndStep; heatMap.YValuesMode = HeatMapValuesMode.OriginAndStep; heatMap.ContourDisplayMode = ContourDisplayMode.Contour; heatMap.Legend.Mode = SeriesLegendMode.SeriesLogic; heatMap.Legend.Format = "<zone_value>"; GenerateData(heatMap); // update chart control from form controls heatMap.ContourDisplayMode = (ContourDisplayMode)ContourDisplayModeDropDownList.SelectedIndex; heatMap.ContourColorMode = (ContourColorMode)ContourColorModeDropDownList.SelectedIndex; heatMap.ShowFill = ShowFillCheckBox.Checked; heatMap.Palette.SmoothPalette = SmoothPaletteCheckBox.Checked; if (heatMap.Palette.SmoothPalette) { heatMap.Legend.Format = "<zone_value>"; } else { heatMap.Legend.Format = "<zone_begin> - <zone_end>"; } }
private void CreateDymmyData(NHeatMapSeries heatMap) { Random rand = new Random(); List <NHeatZone> heatZones = new List <NHeatZone>(); double maxTemperature = 70; while (heatZones.Count < 50) { int x = 0; int y = 0; switch (rand.Next(4)) { case 0: // left x = -(int)maxTemperature / 2 + 1; y = rand.Next(m_SizeY); break; case 1: // top x = rand.Next(m_SizeX); y = -(int)maxTemperature / 2 + 1; break; case 2: // right x = m_SizeX - (int)maxTemperature / 2 - 1; y = rand.Next(m_SizeY); break; case 3: // bottom x = rand.Next(m_SizeX); y = +(int)maxTemperature / 2 - 1; break; } // if no more heat zones -> create new ones NHeatZone heatZone = new NHeatZone(x, y, maxTemperature); do { heatZone.m_DX = rand.Next(4) - 2; heatZone.m_DY = rand.Next(4) - 2; }while (heatZone.m_DX == 0 && heatZone.m_DY == 0); heatZones.Add(heatZone); } // gets the values heatMap.Data.SetValues(double.NaN); double[] values = heatMap.Data.Values; for (int i = heatZones.Count - 1; i >= 0; i--) { NHeatZone heatZone = heatZones[i]; int radius = heatZone.m_Radius; // move the heat zone heatZone.m_X += heatZone.m_DX; heatZone.m_Y += heatZone.m_DY; bool removeZone = false; if (heatZone.m_X < -radius) { removeZone = true; } else if (heatZone.m_X >= m_SizeX + radius) { removeZone = true; } if (heatZone.m_Y < -radius) { removeZone = true; } else if (heatZone.m_Y >= m_SizeX + radius) { removeZone = true; } if (removeZone) { heatZones.RemoveAt(i); } else { int centerX = heatZone.m_X; int centerY = heatZone.m_Y; int startX = Math.Max(0, centerX - radius); int startY = Math.Max(0, centerY - radius); int endX = Math.Min(m_SizeX - 1, centerX + radius); int endY = Math.Min(m_SizeY - 1, centerY + radius); for (int x = startX; x <= endX; x++) { for (int y = startY; y <= endY; y++) { double value = heatZone.m_Temperature - 2 * Math.Sqrt(Math.Pow(x - centerX, 2) + Math.Pow(y - centerY, 2)); if (value >= 0) { int index = y * m_SizeX + x; double curValue = values[index]; if (double.IsNaN(curValue)) { values[index] = value; } else { curValue += value; if (curValue > maxTemperature) { curValue = maxTemperature; } values[index] = curValue; } } } } } } heatMap.Data.OnDataChanged(); }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Panels.Clear(); // set a chart title NLabel title = new NLabel("Heat Map"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.DockMode = PanelDockMode.Top; title.Margins = new NMarginsL(0, 5, 0, 0); nChartControl1.Panels.Add(title); NLegend legend = new NLegend(); legend.DockMode = PanelDockMode.Right; legend.Margins = new NMarginsL(0, 5, 5, 0); legend.FitAlignment = ContentAlignment.TopCenter; nChartControl1.Panels.Add(legend); NCartesianChart chart = new NCartesianChart(); nChartControl1.Panels.Add(chart); chart.DisplayOnLegend = legend; chart.DockMode = PanelDockMode.Fill; chart.BoundsMode = BoundsMode.Stretch; chart.Margins = new NMarginsL(5); // create the heat map (will be updated on timer tick) NHeatMapSeries heatMap = new NHeatMapSeries(); heatMap.Data.SetGridSize(m_SizeX, m_SizeY); heatMap.Data.SetValues(double.NaN); heatMap.Legend.Mode = SeriesLegendMode.SeriesLogic; // used to display palette information heatMap.Legend.PaletteLegendMode = PaletteLegendMode.GradientAxis; heatMap.Legend.PaletteScaleStepMode = PaletteScaleStepMode.SynchronizeWithScaleConfigurator; heatMap.Legend.PaletteLength = new NLength(170); NNumericScaleConfigurator numericScale = heatMap.Legend.PaletteScaleConfigurator as NNumericScaleConfigurator; numericScale.MajorTickMode = MajorTickMode.CustomStep; numericScale.CustomStep = 10; heatMap.Palette.Mode = PaletteMode.AutoMinMaxColor; heatMap.Palette.PositiveColor = Color.FromArgb(125, Color.Red); heatMap.Palette.ZeroColor = Color.FromArgb(125, Color.Blue); heatMap.Palette.SmoothPalette = true; chart.Series.Add(heatMap); // add background image NRangeSeries range = new NRangeSeries(); range.UseXValues = true; range.DataLabelStyle.Visible = false; range.Legend.Mode = SeriesLegendMode.None; range.Values.Add(0); range.Y2Values.Add(m_SizeY); range.XValues.Add(0); range.X2Values.Add(m_SizeX); Bitmap bitmap = new Bitmap(this.MapPathSecure(this.TemplateSourceDirectory + "/USMap.png")); range.FillStyle = new NImageFillStyle(bitmap); chart.Series.Add(range); // then create some dummy data CreateDymmyData(heatMap); }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { nChartControl1.Panels.Clear(); // set a chart title NLabel title = new NLabel("Heat Map Cross Section"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.DockMode = PanelDockMode.Top; nChartControl1.Panels.Add(title); { NCartesianChart heatMapChart = new NCartesianChart(); nChartControl1.Panels.Add(heatMapChart); heatMapChart.DockMode = PanelDockMode.Left; heatMapChart.Size = new NSizeL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(0)); heatMapChart.Margins = new NMarginsL(10); heatMapChart.BoundsMode = BoundsMode.Stretch; heatMapChart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator(); m_BeginEndPointSeries = new NPointSeries(); m_BeginEndPointSeries.Legend.Mode = SeriesLegendMode.None; m_BeginEndPointSeries.UseXValues = true; m_BeginEndPointSeries.DataLabelStyle.Visible = false; m_BeginEndPointSeries.MarkerStyle.Visible = false; m_BeginEndPointSeries.Size = new NLength(8); m_BeginEndPointSeries.PointShape = PointShape.Ellipse; m_BeginEndPointSeries.BorderStyle.Width = new NLength(0); m_BeginEndPointSeries.Values.Add(m_GridSizeY / 4); m_BeginEndPointSeries.XValues.Add(m_GridSizeX / 4); m_BeginEndPointSeries.FillStyles.Add(0, new NColorFillStyle(Color.Red)); m_BeginEndPointSeries.Values.Add(m_GridSizeY * 3 / 4); m_BeginEndPointSeries.XValues.Add(m_GridSizeX * 3 / 4); m_BeginEndPointSeries.FillStyles.Add(1, new NColorFillStyle(Color.Blue)); heatMapChart.Series.Add(m_BeginEndPointSeries); m_BeginEndLineSeries = new NLineSeries(); m_BeginEndLineSeries.UseXValues = true; m_BeginEndLineSeries.DataLabelStyle.Visible = false; heatMapChart.Series.Add(m_BeginEndLineSeries); // create the heat map m_HeatMap = new NHeatMapSeries(); heatMapChart.Series.Add(m_HeatMap); m_HeatMap.Palette.Add(0.0, Color.Purple); m_HeatMap.Palette.Add(1.5, Color.MediumSlateBlue); m_HeatMap.Palette.Add(3.0, Color.CornflowerBlue); m_HeatMap.Palette.Add(4.5, Color.LimeGreen); m_HeatMap.Palette.Add(6.0, Color.LightGreen); m_HeatMap.Palette.Add(7.5, Color.Yellow); m_HeatMap.Palette.Add(9.0, Color.Orange); m_HeatMap.Palette.Add(10.5, Color.Red); m_HeatMap.XValuesMode = HeatMapValuesMode.OriginAndStep; m_HeatMap.YValuesMode = HeatMapValuesMode.OriginAndStep; m_HeatMap.InterpolateImage = false; m_HeatMap.ContourDisplayMode = ContourDisplayMode.None; m_HeatMap.Legend.Mode = SeriesLegendMode.SeriesLogic; m_HeatMap.Legend.Format = "<zone_value>"; GenerateData(); } { NCartesianChart crossSectionLineChart = new NCartesianChart(); nChartControl1.Panels.Add(crossSectionLineChart); crossSectionLineChart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator(); crossSectionLineChart.Axis(StandardAxis.PrimaryX).ScaleConfigurator.Title.Text = "Distance"; crossSectionLineChart.Axis(StandardAxis.PrimaryY).ScaleConfigurator.Title.Text = "Value"; crossSectionLineChart.DockMode = PanelDockMode.Left; crossSectionLineChart.Size = new NSizeL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(0)); crossSectionLineChart.Margins = new NMarginsL(10); crossSectionLineChart.BoundsMode = BoundsMode.Stretch; m_CrossLineSeries = new NLineSeries(); m_CrossLineSeries.DataLabelStyle.Visible = false; m_CrossLineSeries.UseXValues = true; crossSectionLineChart.Series.Add(m_CrossLineSeries); } nChartControl1.Controller.Tools.Add(new NSelectorTool()); NDataPointDragTool dataPointDragTool = new NDataPointDragTool(); dataPointDragTool.DataPointChanged += new EventHandler(OnDataPointDragToolDataPointChanged); dataPointDragTool.DragOutsideAxisRangeMode = DragOutsideAxisRangeMode.Disabled; nChartControl1.Controller.Tools.Add(dataPointDragTool); OnDataPointDragToolDataPointChanged(null, null); }
public override void Initialize() { base.Initialize(); nChartControl1.Panels.Clear(); // set a chart title NLabel title = new NLabel("Heat Map Cross Section"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.DockMode = PanelDockMode.Top; nChartControl1.Panels.Add(title); { NCartesianChart heatMapChart = new NCartesianChart(); nChartControl1.Panels.Add(heatMapChart); heatMapChart.DockMode = PanelDockMode.Left; heatMapChart.Size = new NSizeL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(0)); heatMapChart.BoundsMode = BoundsMode.Stretch; heatMapChart.Margins = new NMarginsL(10); heatMapChart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator(); heatMapChart.Axis(StandardAxis.PrimaryX).ScaleConfigurator.Title.Text = "X Value"; heatMapChart.Axis(StandardAxis.PrimaryY).ScaleConfigurator.Title.Text = "Y Value"; // create the heat map m_HeatMap = new NHeatMapSeries(); heatMapChart.Series.Add(m_HeatMap); m_HeatMap.Palette.Add(0.0, Color.Purple); m_HeatMap.Palette.Add(1.5, Color.MediumSlateBlue); m_HeatMap.Palette.Add(3.0, Color.CornflowerBlue); m_HeatMap.Palette.Add(4.5, Color.LimeGreen); m_HeatMap.Palette.Add(6.0, Color.LightGreen); m_HeatMap.Palette.Add(7.5, Color.Yellow); m_HeatMap.Palette.Add(9.0, Color.Orange); m_HeatMap.Palette.Add(10.5, Color.Red); m_HeatMap.XValuesMode = HeatMapValuesMode.OriginAndStep; m_HeatMap.YValuesMode = HeatMapValuesMode.OriginAndStep; m_HeatMap.InterpolateImage = true; m_HeatMap.ContourDisplayMode = ContourDisplayMode.None; m_HeatMap.Legend.Mode = SeriesLegendMode.SeriesLogic; m_HeatMap.Legend.Format = "<zone_value>"; m_XCursor = new NAxisCursor(); m_XCursor.BeginEndAxis = (int)StandardAxis.PrimaryY; m_XCursor.StrokeStyle.Width = new NLength(2); heatMapChart.Axis(StandardAxis.PrimaryX).Cursors.Add(m_XCursor); m_XCursor.ValueChanged += new EventHandler(OnXCursorValueChanged); m_YCursor = new NAxisCursor(); m_YCursor.BeginEndAxis = (int)StandardAxis.PrimaryX; m_YCursor.StrokeStyle.Width = new NLength(2); heatMapChart.Axis(StandardAxis.PrimaryY).Cursors.Add(m_YCursor); m_YCursor.ValueChanged += new EventHandler(OnYCursorValueChanged); GenerateData(); } { NDockPanel dockPanel = new NDockPanel(); dockPanel.DockMode = PanelDockMode.Fill; dockPanel.PositionChildPanelsInContentBounds = true; dockPanel.Margins = new NMarginsL(10); NCartesianChart xCrossSectionChart; CreateCrossSectionChart(out xCrossSectionChart, out m_XCrossLineSeries); xCrossSectionChart.Axis(StandardAxis.PrimaryX).ScaleConfigurator.Title.Text = "X Value"; xCrossSectionChart.Axis(StandardAxis.PrimaryY).ScaleConfigurator.Title.Text = "Value"; dockPanel.ChildPanels.Add(xCrossSectionChart); NCartesianChart yCrossSectionChart; CreateCrossSectionChart(out yCrossSectionChart, out m_YCrossLineSeries); yCrossSectionChart.Axis(StandardAxis.PrimaryX).ScaleConfigurator.Title.Text = "Y Value"; yCrossSectionChart.Axis(StandardAxis.PrimaryY).ScaleConfigurator.Title.Text = "Value"; dockPanel.ChildPanels.Add(yCrossSectionChart); nChartControl1.Panels.Add(dockPanel); // align the two charts NSideGuideline guideline = new NSideGuideline(PanelSide.Left); guideline.Targets.Add(xCrossSectionChart); guideline.Targets.Add(yCrossSectionChart); nChartControl1.Document.RootPanel.Guidelines.Add(guideline); } m_XCursor.Value = m_GridSizeX / 2.0; m_YCursor.Value = m_GridSizeY / 2.0; nChartControl1.Controller.Tools.Add(new NSelectorTool()); nChartControl1.Controller.Tools.Add(new NAxisCursorDragTool()); }