public override void Initialize() { base.Initialize(); // Configure device and background // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Data Point Drag Tool"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); m_Chart = (NChart)nChartControl1.Charts[0]; nChartControl1.Controller.Tools.Add(new NSelectorTool()); m_DataPointDragTool = new NDataPointDragTool(); m_DataPointDragTool.DepthAxisValue = 0; nChartControl1.Controller.Tools.Add(m_DataPointDragTool); nChartControl1.Controller.Selection.Add(m_Chart); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator(); ChartTypeComboBox.Items.Add("Point"); ChartTypeComboBox.Items.Add("Line"); ChartTypeComboBox.Items.Add("Smooth Line"); ChartTypeComboBox.Items.Add("Bar"); ChartTypeComboBox.SelectedIndex = 0; AllowHorizontalDraggingCheckBox.Checked = true; AllowVerticalDraggingCheckBox.Checked = true; AllowDraggingOutsideAxisRangeCheckBox.Checked = true; Drag2D3DCheckBox.Checked = false; }
/// <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); }