/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Stacked Bar Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); // configure the chart m_Chart = nChartControl1.Charts[0]; m_Chart.Enable3D = true; m_Chart.Width = 65; m_Chart.Height = 40; m_Chart.Axis(StandardAxis.Depth).Visible = false; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.BrightCameraLight); // add interlace stripe NLinearScaleConfigurator linearScale = m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.StripStyles.Add(stripStyle); // add the first bar m_Bar1 = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar); m_Bar1.Name = "Bar1"; m_Bar1.MultiBarMode = MultiBarMode.Series; // add the second bar m_Bar2 = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar); m_Bar2.Name = "Bar2"; m_Bar2.MultiBarMode = MultiBarMode.Stacked; // add the third bar m_Bar3 = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar); m_Bar3.Name = "Bar3"; m_Bar3.MultiBarMode = MultiBarMode.Stacked; // setup value formatting m_Bar1.Values.ValueFormatter = new NNumericValueFormatter("0.###"); m_Bar2.Values.ValueFormatter = new NNumericValueFormatter("0.###"); m_Bar3.Values.ValueFormatter = new NNumericValueFormatter("0.###"); // position data labels in the center of the bars m_Bar1.DataLabelStyle.VertAlign = VertAlign.Center; m_Bar2.DataLabelStyle.VertAlign = VertAlign.Center; m_Bar3.DataLabelStyle.VertAlign = VertAlign.Center; m_Bar1.DataLabelStyle.ArrowLength = new NLength(0); m_Bar2.DataLabelStyle.ArrowLength = new NLength(0); m_Bar3.DataLabelStyle.ArrowLength = new NLength(0); // apply layout ConfigureStandardLayout(m_Chart, title, nChartControl1.Legends[0]); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // init form controls InitLabelsCombo(FirstAreaDataLabelsComboBox); InitLabelsCombo(SecondAreaDataLabelsComboBox); InitLabelsCombo(ThirdAreaDataLabelsComboBox); StackModeComboBox.Items.Add("Stacked"); StackModeComboBox.Items.Add("Stacked %"); StackModeComboBox.SelectedIndex = 0; NExampleHelpers.FillComboWithEnumValues(BarShapeComboBox, typeof(BarShape)); BarShapeComboBox.SelectedIndex = 0; PositiveDataButton_Click(null, null); ShowDataLabelsCheckBox_Checked(null, null); }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Multi Series Area Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); // apply predefined projection and lighting NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); chart.Width = 65.0f; chart.Height = 40.0f; chart.Depth = 40.0f; // add interlace stripe NLinearScaleConfigurator linearScale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.StripStyles.Add(stripStyle); // add the first area NAreaSeries area1 = (NAreaSeries)chart.Series.Add(SeriesType.Area); area1.MultiAreaMode = MultiAreaMode.Series; area1.DataLabelStyle.Visible = false; area1.Name = "Area 1"; area1.Values.FillRandomRange(Random, 15, 10, 40); // add the second area NAreaSeries area2 = (NAreaSeries)chart.Series.Add(SeriesType.Area); area2.MultiAreaMode = MultiAreaMode.Series; area2.DataLabelStyle.Visible = false; area2.Name = "Area 2"; area2.Values.FillRandomRange(Random, 15, 30, 60); // add the third area NAreaSeries area3 = (NAreaSeries)chart.Series.Add(SeriesType.Area); area3.MultiAreaMode = MultiAreaMode.Series; area3.DataLabelStyle.Visible = false; area3.Name = "Area 3"; area3.Values.FillRandomRange(Random, 15, 50, 80); // apply layout ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("XYZ Scatter Smooth Line"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // setup chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); chart.Depth = 55.0f; chart.Width = 55.0f; chart.Height = 55.0f; // setup Y axis NLinearScaleConfigurator linearScaleConfigurator = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; // add interlace stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); linearScaleConfigurator.StripStyles.Add(stripStyle); // setup X axis linearScaleConfigurator = new NLinearScaleConfigurator(); linearScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScaleConfigurator.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Floor }; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScaleConfigurator; // setup Z axis linearScaleConfigurator = new NLinearScaleConfigurator(); linearScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScaleConfigurator.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Left, ChartWallType.Floor }; chart.Axis(StandardAxis.Depth).ScaleConfigurator = linearScaleConfigurator; // setup the smooth line series NSmoothLineSeries line = (NSmoothLineSeries)chart.Series.Add(SeriesType.SmoothLine); line.Name = "Smooth Line"; line.InflateMargins = true; line.Legend.Mode = SeriesLegendMode.None; line.DataLabelStyle.Visible = false; line.MarkerStyle.Visible = true; line.MarkerStyle.PointShape = PointShape.Sphere; line.MarkerStyle.AutoDepth = false; line.MarkerStyle.Width = new NLength(1.4f, NRelativeUnit.ParentPercentage); line.MarkerStyle.Height = new NLength(1.4f, NRelativeUnit.ParentPercentage); line.MarkerStyle.Depth = new NLength(1.4f, NRelativeUnit.ParentPercentage); line.UseXValues = true; line.UseZValues = true; ChangeData(line); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
public override void Initialize() { base.Initialize(); nChartControl1.Settings.RenderSurface = RenderSurface.Window; nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); // set a chart title NLabel title = nChartControl1.Labels.AddHeader(""); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.TextFormat = TextFormat.XML; title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); // setup chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Width = 60.0f; chart.Depth = 60.0f; chart.Height = 50.0f; chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); // setup axes NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; scaleY.MajorTickMode = MajorTickMode.AutoMaxCount; scaleY.MaxTickCount = 5; NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.RoundToTickMax = false; linearScale.RoundToTickMin = false; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale; linearScale = new NLinearScaleConfigurator(); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.RoundToTickMax = false; linearScale.RoundToTickMin = false; chart.Axis(StandardAxis.Depth).ScaleConfigurator = linearScale; // setup surface series m_Surface = new NVertexSurfaceSeries(); chart.Series.Add(m_Surface); m_Surface.Name = "Surface"; m_Surface.SyncPaletteWithAxisScale = false; m_Surface.PaletteSteps = 8; m_Surface.ValueFormatter.FormatSpecifier = "0.00"; m_Surface.FillMode = SurfaceFillMode.ZoneTexture; m_Surface.ShadingMode = ShadingMode.Smooth; m_Surface.SmoothPalette = true; // apply layout ConfigureStandardLayout(chart, title, null); VertexPrimitiveCombo.FillFromEnum(typeof(VertexPrimitive)); VertexPrimitiveCombo.SelectedIndex = (int)VertexPrimitive.Points; }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = new NLabel("3D Vector Field"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); // no legend nChartControl1.Legends.Clear(); // setup chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Projection.Type = ProjectionType.Perspective; chart.Projection.Rotation = -18; chart.Projection.Elevation = 13; chart.Depth = 55.0f; chart.Width = 55.0f; chart.Height = 55.0f; // setup X axis NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale; linearScale.RoundToTickMin = false; linearScale.RoundToTickMax = false; linearScale.MajorGridStyle.ShowAtWalls = new ChartWallType[] { }; // setup Y axis linearScale = new NLinearScaleConfigurator(); chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale; linearScale.RoundToTickMin = false; linearScale.RoundToTickMax = false; linearScale.MajorGridStyle.ShowAtWalls = new ChartWallType[] { }; // setup Z axis linearScale = new NLinearScaleConfigurator(); chart.Axis(StandardAxis.Depth).ScaleConfigurator = linearScale; linearScale.RoundToTickMin = false; linearScale.RoundToTickMax = false; linearScale.MajorGridStyle.ShowAtWalls = new ChartWallType[] { }; // setup shape series NVectorSeries vectorSeries = (NVectorSeries)chart.Series.Add(SeriesType.Vector); vectorSeries.FillStyle = new NColorFillStyle(Color.Red); vectorSeries.BorderStyle.Color = Color.DarkRed; vectorSeries.Legend.Mode = SeriesLegendMode.None; vectorSeries.DataLabelStyle.Visible = false; vectorSeries.InflateMargins = true; vectorSeries.UseXValues = true; vectorSeries.UseZValues = true; vectorSeries.MinArrowHeadSize = new NSizeL(2, 3); vectorSeries.MaxArrowHeadSize = new NSizeL(4, 6); // fill data FillData(vectorSeries); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Custom Scale Breaks<br/> <font size = '9pt'>Demonstrates how to apply custom scale breaks to the chart axes</font>"); title.TextStyle.TextFormat = TextFormat.XML; 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)); // turn off the legend NLegend legend = nChartControl1.Legends[0]; legend.Mode = LegendMode.Disabled; NChart chart = nChartControl1.Charts[0]; Random random = new Random(); // create three random point series for (int i = 0; i < 3; i++) { NPointSeries point = new NPointSeries(); point.UseXValues = true; point.UseZValues = true; point.DataLabelStyle.Visible = false; point.Size = new NLength(5); point.BorderStyle.Width = new NLength(0); // fill in some random data for (int j = 0; j < 30; j++) { point.Values.Add(5 + random.Next(90)); point.XValues.Add(5 + random.Next(90)); point.ZValues.Add(5 + random.Next(90)); } chart.Series.Add(point); } // create scale breaks m_FirstHorzScaleBreak = new NCustomScaleBreak(new NLineScaleBreakStyle(new NColorFillStyle(Color.FromArgb(124, Color.Orange)), null, new NLength(10)), new NRange1DD(10, 20)); m_SecondHorzScaleBreak = new NCustomScaleBreak(new NLineScaleBreakStyle(new NColorFillStyle(Color.FromArgb(124, Color.Green)), null, new NLength(10)), new NRange1DD(80, 90)); m_FirstVertScaleBreak = new NCustomScaleBreak(new NLineScaleBreakStyle(new NColorFillStyle(Color.FromArgb(124, Color.Red)), null, new NLength(10)), new NRange1DD(10, 20)); m_SecondVertScaleBreak = new NCustomScaleBreak(new NLineScaleBreakStyle(new NColorFillStyle(Color.FromArgb(124, Color.Blue)), null, new NLength(10)), new NRange1DD(80, 90)); // initalize form controls FirstHorzBreakBeginUpDown.Value = (decimal)10; FirstHorzBreakEndUpDown.Value = (decimal)20; SecondHorzBreakBeginUpDown.Value = (decimal)80; SecondHorzBreakEndUpDown.Value = (decimal)90; FirstVertBreakBeginUpDown.Value = (decimal)10; FirstVertBreakEndUpDown.Value = (decimal)20; SecondVertBreakBeginUpDown.Value = (decimal)80; SecondVertBreakEndUpDown.Value = (decimal)90; // configure scales NLinearScaleConfigurator xScale = new NLinearScaleConfigurator(); xScale.RoundToTickMax = true; xScale.RoundToTickMin = true; xScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); xScale.ScaleBreaks.Add(m_FirstHorzScaleBreak); xScale.ScaleBreaks.Add(m_SecondHorzScaleBreak); // add an interlaced strip to the X axis NScaleStripStyle xInterlacedStrip = new NScaleStripStyle(); xInterlacedStrip.SetShowAtWall(ChartWallType.Back, true); xInterlacedStrip.Interlaced = true; xInterlacedStrip.FillStyle = new NColorFillStyle(Color.FromArgb(40, Color.LightGray)); xScale.StripStyles.Add(xInterlacedStrip); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = xScale; chart.Axis(StandardAxis.PrimaryX).View = new NRangeAxisView(new NRange1DD(0, 100)); NLinearScaleConfigurator yScale = new NLinearScaleConfigurator(); yScale.RoundToTickMax = true; yScale.RoundToTickMin = true; yScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); yScale.ScaleBreaks.Add(m_FirstVertScaleBreak); yScale.ScaleBreaks.Add(m_SecondVertScaleBreak); // add an interlaced strip to the Y axis NScaleStripStyle yInterlacedStrip = new NScaleStripStyle(); yInterlacedStrip.SetShowAtWall(ChartWallType.Back, true); yInterlacedStrip.Interlaced = true; yInterlacedStrip.FillStyle = new NColorFillStyle(Color.FromArgb(40, Color.LightGray)); yScale.StripStyles.Add(yInterlacedStrip); chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = yScale; chart.Axis(StandardAxis.PrimaryY).View = new NRangeAxisView(new NRange1DD(0, 100)); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // fill the combo LineStyleDropDownList.Items.Add("Line"); LineStyleDropDownList.Items.Add("Tape"); LineStyleDropDownList.Items.Add("Tube"); LineStyleDropDownList.Items.Add("Ellipsoid"); LineStyleDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithEnumValues(MarkerShapeDropDownList, typeof(PointShape)); MarkerShapeDropDownList.SelectedIndex = 1; WebExamplesUtilities.FillComboWithPercents(LineDepthDropDownList, 10); LineDepthDropDownList.SelectedIndex = 4; WebExamplesUtilities.FillComboWithValues(LineWidthDropDownList, 0, 5, 1); LineWidthDropDownList.SelectedIndex = 1; WebExamplesUtilities.FillComboWithColorNames(LineColorDropDownList, KnownColor.DarkSalmon); WebExamplesUtilities.FillComboWithColorNames(LineFillColorDropDownList, KnownColor.LightSalmon); WebExamplesUtilities.FillComboWithValues(MarkerSizeDropDownList, 0, 10, 1); MarkerSizeDropDownList.SelectedIndex = 2; ShowMarkersCheckBox.Checked = true; LeftAxisRoundToTickCheckBox.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("3D Line Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective2); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); chart.Axis(StandardAxis.Depth).Visible = false; // setup Y axis NLinearScaleConfigurator scaleY = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; scaleY.RoundToTickMin = LeftAxisRoundToTickCheckBox.Checked; scaleY.RoundToTickMax = LeftAxisRoundToTickCheckBox.Checked; // add Y axis interlaced stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); scaleY.StripStyles.Add(stripStyle); // setup X axis NOrdinalScaleConfigurator scaleX = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator; scaleX.MajorTickMode = MajorTickMode.AutoMaxCount; scaleX.DisplayDataPointsBetweenTicks = false; // setup the line series NLineSeries nLine = (NLineSeries)chart.Series.Add(SeriesType.Line); nLine.Values.FillRandom(Random, 10); nLine.DataLabelStyle.Visible = false; nLine.Legend.Mode = SeriesLegendMode.DataPoints; nLine.BorderStyle.Width = new NLength(LineWidthDropDownList.SelectedIndex, NGraphicsUnit.Pixel); nLine.DepthPercent = LineDepthDropDownList.SelectedIndex * 10; nLine.BorderStyle.Color = WebExamplesUtilities.ColorFromDropDownList(LineColorDropDownList); nLine.FillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(LineFillColorDropDownList)); nLine.InflateMargins = InflateMarginsCheckBox.Checked; nLine.MarkerStyle.Visible = ShowMarkersCheckBox.Checked; bool bSimpleLine = (LineStyleDropDownList.SelectedIndex == 0); switch (LineStyleDropDownList.SelectedIndex) { case 0: // simple line nLine.LineSegmentShape = LineSegmentShape.Line; break; case 1: // tape nLine.LineSegmentShape = LineSegmentShape.Tape; break; case 2: // tube nLine.LineSegmentShape = LineSegmentShape.Tube; break; case 3: // elipsoid nLine.LineSegmentShape = LineSegmentShape.Ellipsoid; break; } LineDepthDropDownList.Enabled = !bSimpleLine; LineFillColorDropDownList.Enabled = !bSimpleLine; MarkerShapeDropDownList.Enabled = ShowMarkersCheckBox.Checked; MarkerSizeDropDownList.Enabled = ShowMarkersCheckBox.Checked; if (nLine.MarkerStyle.Visible) { nLine.MarkerStyle.PointShape = (PointShape)MarkerShapeDropDownList.SelectedIndex; nLine.MarkerStyle.Height = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage); nLine.MarkerStyle.Width = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage); nLine.MarkerStyle.FillStyle = new NColorFillStyle(Red); nLine.MarkerStyle.BorderStyle.Color = WebExamplesUtilities.ColorFromDropDownList(LineColorDropDownList); } // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
private void callLowHighGraph(string projectName, string ScenarioName) { nChartControl1.Clear(); nChartControl1.Legends.Clear(); NLabel title = nChartControl1.Labels.AddHeader("이미지별 최대 최소 시간"); //title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Bold); title.TextStyle.FontStyle = new NFontStyle(pfc.Families[0].ToString(), 18, FontStyle.Regular); //title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); // configure the chart m_Chart = nChartControl1.Charts[0]; m_Chart.Axis(StandardAxis.Depth).Visible = false; // add a High-Low series m_HighLow = (NHighLowSeries)m_Chart.Series.Add(SeriesType.HighLow); m_HighLow.Name = "High-Low Series"; m_HighLow.HighFillStyle = new NColorFillStyle(Color.FromArgb(68, 90, 108)); m_HighLow.HighBorderStyle = new NStrokeStyle(Color.FromArgb(254, 181, 25)); //m_HighLow.LowFillStyle = new NColorFillStyle(DarkOrange); m_HighLow.DataLabelStyle.Visible = true; m_HighLow.DataLabelStyle.Format = " <high_value>\n<low_value>"; m_HighLow.LowValues.ValueFormatter = new NNumericValueFormatter("0.##"); m_HighLow.HighValues.ValueFormatter = new NNumericValueFormatter("0.##"); m_HighLow.DropLines = true; m_HighLow.ClearDataPoints(); NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); //m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale; m_Chart.Axis(StandardAxis.PrimaryX).ScrollBar.ResetButton.Visible = false; NNumericAxisPagingView numericPagingView = new NNumericAxisPagingView(new NRange1DD(0, 10)); m_Chart.Axis(StandardAxis.PrimaryX).PagingView = numericPagingView; m_Chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true; nChartControl1.Controller.Tools.Add(new NAxisScrollTool()); NStandardScaleConfigurator scaleConfiguratorX = (NStandardScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; scaleConfiguratorX.MajorTickMode = MajorTickMode.AutoMaxCount; scaleConfiguratorX.AutoLabels = false; // data 값을 다 불러와서 foreach (ResultData.ResultInfo temp in rData.getRData()) { // 현재 찾고자 하는 프로젝트와 시나리오랑 같으면 if (temp.projectName == projectName && temp.taskName == ScenarioName) { // 해당 시나리오 값에서 이동한 path 이미지들 값 가져오기 foreach (ResultData.ImgTime imgTemp in temp.pathInfo) { bool inList = false; float timeValue = System.Convert.ToSingle(imgTemp.timeImg); // 리스트 내에 같은 값 찾기 if (ImgTimeInfo.Count != 0) { foreach (ImgTime inListImg in ImgTimeInfo) { // 같은게 있다면 if (inListImg.imgName == imgTemp.imgName) { // 현재 값이 high 보다 크다면 if (inListImg.High <= timeValue) inListImg.High = timeValue; else if (inListImg.Low >= timeValue) inListImg.Low = timeValue; inList = true; break; } } } // 리스트 내에 없다면 if (inList == false) ImgTimeInfo.Add(new ImgTime() { imgName = imgTemp.imgName, High = timeValue, Low = timeValue }); } } } foreach (ImgTime listImg in ImgTimeInfo) { scaleConfiguratorX.Labels.Add(listImg.imgName); m_HighLow.HighValues.Add(listImg.High); m_HighLow.LowValues.Add(listImg.Low); } nChartControl1.Refresh(); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Axis Docking<br/> <font size = '9pt'>Demonstrates how to use of the dock axis anchor and how to add custom axes</font>"); title.TextStyle.TextFormat = TextFormat.XML; title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Center; title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // no legend nChartControl1.Legends.Clear(); // setup chart m_Chart = nChartControl1.Charts[0]; m_Chart.BoundsMode = BoundsMode.Stretch; m_Chart.Location = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); m_RedAxis = m_Chart.Axis(StandardAxis.PrimaryY); m_GreenAxis = m_Chart.Axis(StandardAxis.SecondaryY); m_GreenAxis.Visible = true; // Add a custom vertical axis m_BlueAxis = ((NCartesianAxisCollection)m_Chart.Axes).AddCustomAxis(AxisOrientation.Vertical, AxisDockZone.FrontLeft); // create three line series and dispay them on three vertical axes (red, green and blue axis) NLineSeries line1 = CreateLineSeries(Color.Red, Color.DarkRed, 10, 20); NLineSeries line2 = CreateLineSeries(Color.Green, Color.DarkGreen, 50, 100); NLineSeries line3 = CreateLineSeries(Color.Blue, Color.DarkBlue, 100, 200); line1.DisplayOnAxis(StandardAxis.PrimaryY, true); line2.DisplayOnAxis(StandardAxis.PrimaryY, false); line2.DisplayOnAxis(StandardAxis.SecondaryY, true); line3.DisplayOnAxis(StandardAxis.PrimaryY, false); line3.DisplayOnAxis(m_BlueAxis.AxisId, true); // now configure the axis appearance NLinearScaleConfigurator linearScale; // setup the red axis linearScale = new NLinearScaleConfigurator(); m_RedAxis.ScaleConfigurator = linearScale; linearScale.RulerStyle.FillStyle = new NColorFillStyle(Color.DarkRed); linearScale.RulerStyle.BorderStyle.Color = Color.Red; linearScale.InnerMajorTickStyle.LineStyle.Color = Color.Red; linearScale.OuterMajorTickStyle.LineStyle.Color = Color.Red; linearScale.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Left }; linearScale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.DarkRed); // setup the green axis linearScale = new NLinearScaleConfigurator(); m_GreenAxis.ScaleConfigurator = linearScale; linearScale.RulerStyle.FillStyle = new NColorFillStyle(Color.DarkGreen); linearScale.RulerStyle.BorderStyle.Color = Color.Green; linearScale.InnerMajorTickStyle.LineStyle.Color = Color.Green; linearScale.OuterMajorTickStyle.LineStyle.Color = Color.Green; linearScale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.DarkGreen); linearScale.RulerStyle.FillStyle = new NColorFillStyle(Color.DarkBlue); linearScale.RulerStyle.BorderStyle.Color = Color.Blue; linearScale.InnerMajorTickStyle.LineStyle.Color = Color.Blue; linearScale.OuterMajorTickStyle.LineStyle.Color = Color.Blue; linearScale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.DarkBlue); RedAxisZoneCombo.SelectedIndex = 0; GreenAxisZoneCombo.SelectedIndex = 0; BlueAxisZoneCombo.SelectedIndex = 0; UpdateAxisAnchors(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { WebExamplesUtilities.FillComboWithColorNames(UpColorDropDownList, KnownColor.Black); WebExamplesUtilities.FillComboWithColorNames(DownColorDropDownList, KnownColor.Black); WebExamplesUtilities.FillComboWithValues(UpStrokeDropDownList, 1, 3, 1); UpStrokeDropDownList.SelectedIndex = 1; WebExamplesUtilities.FillComboWithValues(DownStrokeDropDownList, 1, 3, 1); reversalAmountDropdownlist.Items.AddRange(new ListItem[] { new ListItem("0.5"), new ListItem("1"), new ListItem("2"), new ListItem("1%"), new ListItem("2%"), new ListItem("5%") }); } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // no legend nChartControl1.Legends.Clear(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Kagi Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; // setup X axis NPriceScaleConfigurator priceConfigurator = new NPriceScaleConfigurator(); priceConfigurator.InnerMajorTickStyle.LineStyle.Width = new NLength(0); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = priceConfigurator; // setup Y axis NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.StripStyles.Add(stripStyle); //Setup Kagi series NKagiSeries kagi = (NKagiSeries)chart.Series.Add(SeriesType.Kagi); kagi.UpStrokeStyle.Color = WebExamplesUtilities.ColorFromDropDownList(UpColorDropDownList); kagi.DownStrokeStyle.Color = WebExamplesUtilities.ColorFromDropDownList(DownColorDropDownList); kagi.UpStrokeStyle.Width = new NLength(Convert.ToInt32(UpStrokeDropDownList.SelectedValue)); kagi.DownStrokeStyle.Width = new NLength(Convert.ToInt32(DownStrokeDropDownList.SelectedValue)); kagi.UseXValues = true; switch (reversalAmountDropdownlist.SelectedIndex) { case 0: kagi.ReversalAmount = 0.5; kagi.ReversalAmountInPercents = false; break; case 1: kagi.ReversalAmount = 1; kagi.ReversalAmountInPercents = false; break; case 2: kagi.ReversalAmount = 2; kagi.ReversalAmountInPercents = false; break; case 3: kagi.ReversalAmount = 1; kagi.ReversalAmountInPercents = true; break; case 4: kagi.ReversalAmount = 2; kagi.ReversalAmountInPercents = true; break; case 5: kagi.ReversalAmount = 5; kagi.ReversalAmountInPercents = true; break; } GenerateData(kagi); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("DateTime Smooth Line"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // no legend nChartControl1.Legends.Clear(); // setup chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; // setup X axis NDateTimeScaleConfigurator scaleX = new NDateTimeScaleConfigurator(); scaleX.EnableUnitSensitiveFormatting = false; scaleX.LabelValueFormatter = new NDateTimeValueFormatter("dd MMM"); scaleX.LabelStyle.Angle = new NScaleLabelAngle(90); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // setup Y axis NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; // add interlace stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleY.StripStyles.Add(stripStyle); // add the line NSmoothLineSeries line = (NSmoothLineSeries)chart.Series.Add(SeriesType.SmoothLine); line.Name = "Smooth Line"; line.InflateMargins = true; line.DataLabelStyle.Visible = false; line.MarkerStyle.Visible = true; line.MarkerStyle.PointShape = PointShape.Cylinder; line.MarkerStyle.AutoDepth = false; line.MarkerStyle.Width = new NLength(1.4f, NRelativeUnit.ParentPercentage); line.MarkerStyle.Height = new NLength(1.4f, NRelativeUnit.ParentPercentage); line.MarkerStyle.Depth = new NLength(1.4f, NRelativeUnit.ParentPercentage); line.UseXValues = true; line.UseZValues = false; line.Use1DInterpolationForXYScatter = true; // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); GenreateYValues(nValuesCount); GenreateXValues(nValuesCount); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
private NLinearScaleConfigurator GetScaleConfigurator() { NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); linearScale.SetPredefinedScaleStyle(PredefinedScaleStyle.Scientific); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, MapWindowVariable.ShowGridSet); linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.RoundToTickMin = false; linearScale.RoundToTickMax = false; return linearScale; }
void SetupChartAxes(NChart chart) { NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator(); scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dash; scaleY.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleY.InnerMajorTickStyle.Visible = false; chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY; NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator(); scaleX.MajorGridStyle.LineStyle.Pattern = LinePattern.Dash; scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.InnerMajorTickStyle.Visible = false; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { EnableInitialPositioningCheckBox.Checked = true; EnableLabelAdjustmentCheckBox.Checked = true; HiddenField1.Value = Random.Next().ToString(); } nChartControl1.Settings.JitterMode = JitterMode.Enabled; nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Cluster Stack Bar Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); // configure the chart NChart chart = nChartControl1.Charts[0]; // configure Y axis NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator(); scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; scaleY.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY; // add interlaced stripe for Y axis NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleY.StripStyles.Add(stripStyle); NSizeL dataPointSafeguardSize = new NSizeL( new NLength(1.3f, NRelativeUnit.ParentPercentage), new NLength(1.3f, NRelativeUnit.ParentPercentage)); // series 1 NBarSeries series1 = (NBarSeries)chart.Series.Add(SeriesType.Bar); series1.Name = "Bar 1"; series1.FillStyle = new NColorFillStyle(DarkOrange); series1.DataLabelStyle.Visible = true; series1.DataLabelStyle.VertAlign = VertAlign.Center; series1.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8); // series 2 NBarSeries series2 = (NBarSeries)chart.Series.Add(SeriesType.Bar); series2.Name = "Bar 2"; series2.MultiBarMode = MultiBarMode.Stacked; series2.FillStyle = new NColorFillStyle(Green); series2.DataLabelStyle.Visible = true; series2.DataLabelStyle.VertAlign = VertAlign.Center; series2.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8); // series 3 NBarSeries series3 = (NBarSeries)chart.Series.Add(SeriesType.Bar); series3.Name = "Bar 3"; series3.MultiBarMode = MultiBarMode.Clustered; series3.FillStyle = new NColorFillStyle(Red); series3.DataLabelStyle.Visible = true; series3.DataLabelStyle.VertAlign = VertAlign.Top; series3.DataLabelStyle.ArrowLength = new NLength(10); series3.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8); // generate random data GenerateData(chart); // enable initial labels positioning chart.LabelLayout.EnableInitialPositioning = EnableInitialPositioningCheckBox.Checked; // enable label adjustment chart.LabelLayout.EnableLabelAdjustment = EnableLabelAdjustmentCheckBox.Checked; // series 1 data points must not be overlapped series1.LabelLayout.EnableDataPointSafeguard = true; series1.LabelLayout.DataPointSafeguardSize = dataPointSafeguardSize; // do not use label location proposals for series 1 series1.LabelLayout.UseLabelLocations = false; // series 2 data points must not be overlapped series2.LabelLayout.EnableDataPointSafeguard = true; series2.LabelLayout.DataPointSafeguardSize = dataPointSafeguardSize; // do not use label location proposals for series 2 series2.LabelLayout.UseLabelLocations = false; // series 3 data points must not be overlapped series3.LabelLayout.EnableDataPointSafeguard = true; series3.LabelLayout.DataPointSafeguardSize = dataPointSafeguardSize; // series 3 data labels can be placed above and below the origin point series3.LabelLayout.UseLabelLocations = true; series3.LabelLayout.LabelLocations = new LabelLocation[] { LabelLocation.Top, LabelLocation.Bottom }; series3.LabelLayout.InvertLocationsIfIgnored = false; series3.LabelLayout.OutOfBoundsLocationMode = OutOfBoundsLocationMode.PushWithinBounds; // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { nChartControl1.Settings.ShapeRenderingMode = ShapeRenderingMode.None; nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Surface Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); // setup chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.BoundsMode = BoundsMode.Fit; chart.Width = 60.0f; chart.Depth = 60.0f; chart.Height = 10.0f; chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); chart.Projection.Elevation = 45; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft); // setup Y axis NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator(); scaleY.RoundToTickMax = false; scaleY.RoundToTickMin = false; scaleY.MinTickDistance = new NLength(10, NGraphicsUnit.Point); scaleY.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Left, ChartWallType.Back }; scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY; // setup X axis NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator(); scaleX.RoundToTickMax = false; scaleX.RoundToTickMin = false; scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Back }; scaleX.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // setup Z axis NLinearScaleConfigurator scaleZ = new NLinearScaleConfigurator(); scaleZ.RoundToTickMax = false; scaleZ.RoundToTickMin = false; scaleZ.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Left }; scaleZ.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.Depth).ScaleConfigurator = scaleZ; // add the surface series NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series.Add(SeriesType.TriangulatedSurface); surface.Name = "Surface"; surface.Legend.Mode = SeriesLegendMode.SeriesLogic; surface.SyncPaletteWithAxisScale = false; surface.ValueFormatter.FormatSpecifier = "0.00"; surface.FillStyle = new NColorFillStyle(Color.YellowGreen); FillData(); // apply layout ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]); // form controls FillModeComboBox.Items.Add("None"); FillModeComboBox.Items.Add("Uniform"); FillModeComboBox.Items.Add("Zone"); FrameModeComboBox.Items.Add("None"); FrameModeComboBox.Items.Add("Mesh"); FrameModeComboBox.Items.Add("Contour"); FrameModeComboBox.Items.Add("Mesh-Contour"); FrameModeComboBox.Items.Add("Dots"); FrameColorModeComboBox.Items.Add("Uniform"); FrameColorModeComboBox.Items.Add("Zone"); PositionModeComboBox.Items.Add("Axis Begin"); PositionModeComboBox.Items.Add("Axis End"); PositionModeComboBox.Items.Add("Custom Value"); SmoothShadingCheckBox.IsChecked = true; SmoothPaletteCheckBox.IsChecked = false; FillModeComboBox.SelectedIndex = 2; FrameModeComboBox.SelectedIndex = 2; FrameColorModeComboBox.SelectedIndex = 0; PositionModeComboBox.SelectedIndex = 0; CustomValueScrollBar.Value = 0.1f; PositionModeComboBox.IsEnabled = false; CustomValueScrollBar.IsEnabled = false; DrawFlatCheckBox_Checked(null, null); SmoothShadingCheckBox_Checked(null, null); SmoothPaletteCheckBox_Checked(null, null); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Stacked Area Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // setup the chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Width = 65; chart.Height = 40; chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective2); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); // setup X axis NOrdinalScaleConfigurator scaleX = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator; scaleX.AutoLabels = false; scaleX.MajorTickMode = MajorTickMode.AutoMaxCount; scaleX.DisplayDataPointsBetweenTicks = false; for (int i = 0; i < categoriesCount; i++) { scaleX.CustomLabels.Add(new NCustomValueLabel(i, (2000 + i).ToString())); } // add interlaced stripe for Y axis NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Left }; NLinearScaleConfigurator scaleY = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; scaleY.StripStyles.Add(stripStyle); // hide Z axis chart.Axis(StandardAxis.Depth).Visible = false; // add the first area NAreaSeries area0 = (NAreaSeries)chart.Series.Add(SeriesType.Area); area0.MultiAreaMode = MultiAreaMode.Series; area0.Name = "Product A"; SetupDataLabels(area0); // add the second Area NAreaSeries area1 = (NAreaSeries)chart.Series.Add(SeriesType.Area); area1.MultiAreaMode = MultiAreaMode.Stacked; area1.Name = "Product B"; SetupDataLabels(area1); // add the third Area NAreaSeries area2 = (NAreaSeries)chart.Series.Add(SeriesType.Area); area2.MultiAreaMode = MultiAreaMode.Stacked; area2.Name = "Product C"; SetupDataLabels(area2); // fill with random data area0.Values.FillRandomRange(Random, categoriesCount, 20, 50); area1.Values.FillRandomRange(Random, categoriesCount, 20, 50); area2.Values.FillRandomRange(Random, categoriesCount, 20, 50); // apply layout ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // init form controls InitLabelsCombo(FirstAreaDataLabelsCombo); InitLabelsCombo(SecondAreaDataLabelsCombo); InitLabelsCombo(ThirdAreaDataLabelsCombo); StackModeCombo.Items.Add("Stack"); StackModeCombo.Items.Add("Stack 100%"); StackModeCombo.SelectedIndex = 0; ShowDataLabelsCheck_CheckedChanged(null, null); }
public override void Initialize() { base.Initialize(); nChartControl1.Settings.ShapeRenderingMode = ShapeRenderingMode.None; // add a trackball tool so that the user can rotate the chart nChartControl1.Controller.Tools.Clear(); nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Surface"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.Cache = true; // no legend nChartControl1.Legends.Clear(); // setup chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Width = 55.0f; chart.Depth = 55.0f; chart.Height = 4.0f; chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.MetallicLustre); NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; scaleY.AutoLabels = false; scaleY.MajorTickMode = MajorTickMode.AutoMaxCount; scaleY.MaxTickCount = 5; NOrdinalScaleConfigurator ordinalScale = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); ordinalScale.DisplayDataPointsBetweenTicks = false; ordinalScale = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.Depth).ScaleConfigurator; ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); ordinalScale.DisplayDataPointsBetweenTicks = false; // add the surface series NGridSurfaceSeries surface = (NGridSurfaceSeries)chart.Series.Add(SeriesType.GridSurface); surface.Name = "Surface"; surface.FrameMode = SurfaceFrameMode.None; surface.ShadingMode = ShadingMode.Smooth; surface.AutomaticPalette = true; surface.SyncPaletteWithAxisScale = false; // NOTE: Cell triangulation mode is important for performance. Use Diagonal1 or Diagonal2 for faster rendering. surface.CellTriangulationMode = SurfaceCellTriangulationMode.Diagonal1; NColorFillStyle fill = new NColorFillStyle(); fill.MaterialStyle.Ambient = Color.FromArgb(122, 125, 110); fill.MaterialStyle.Diffuse = Color.FromArgb(122, 125, 110); fill.MaterialStyle.Specular = Color.DimGray; surface.FillStyle = fill; // apply layout ConfigureStandardLayout(chart, title, null); // init form controls useHardwareAccelerationCheck.Checked = true; surfaceSizeCombo.SelectedIndex = 0; fillModeCombo.SelectedIndex = 1; }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel header = nChartControl1.Labels.AddHeader("Train Sales"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL( new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); nChartControl1.Legends[0].Mode = LegendMode.Disabled; NChart chart = nChartControl1.Charts[0]; // perform manual stretch float fAspect = ((float)nChartControl1.Width.Value / (float)nChartControl1.Height.Value); // perform manual stretch if (fAspect > 1) { chart.Width = 86 * fAspect; chart.Height = 70; } else { chart.Width = 86; chart.Height = 70 * fAspect; } chart.Location = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(18, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL(new NLength(86, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage)); chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); chart.Wall(ChartWallType.Floor).Visible = false; chart.Wall(ChartWallType.Left).Visible = false; chart.Axis(StandardAxis.Depth).Visible = false; chart.Axis(StandardAxis.Depth).Visible = false; NOrdinalScaleConfigurator ordinalScaleConfigurator = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; ordinalScaleConfigurator.InnerMajorTickStyle.LineStyle.Width = new NLength(0, NGraphicsUnit.Pixel); ordinalScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; ordinalScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, false); ordinalScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); NDockAxisAnchor anchor = new NDockAxisAnchor(AxisDockZone.FrontBottom, false, 5, 95); chart.Axis(StandardAxis.PrimaryX).Anchor = anchor; NLinearScaleConfigurator linearSclaeConfigurator = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearSclaeConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; NLineSeries line = (NLineSeries)chart.Series.Add(SeriesType.Line); NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.Name = "Bar Series"; bar.BorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); bar.FillStyle = new NColorFillStyle(Color.MediumPurple); bar.DataLabelStyle.Visible = false; bar.InflateMargins = true; // fill with random data Random random = new Random(); bar.Values.FillRandom(random, 10); // generate a data series cumulative sum of the bar values NFunctionCalculator fc = new NFunctionCalculator(); fc.Expression = "CUMSUM(Value)"; fc.Arguments.Add(bar.Values); // display this data series as line line.Name = "Cumulative"; line.Values = fc.Calculate(); line.MarkerStyle.Visible = true; line.MarkerStyle.PointShape = PointShape.Cylinder; line.DataLabelStyle.Visible = false; line.DataLabelStyle.ArrowStrokeStyle.Width = new NLength(0, NGraphicsUnit.Pixel); bar.BarShape = BarShape.Cylinder; for (int i = 0; i < bar.Values.Count; i++) { bar.FillStyles[i] = new NColorFillStyle(WebExamplesUtilities.RandomColor()); } bar.Legend.Mode = SeriesLegendMode.DataPoints; line.Legend.Mode = SeriesLegendMode.None; NImageResponse imageResponse = new NImageResponse(); imageResponse.StreamImageToBrowser = true; nChartControl1.ServerSettings.BrowserResponseSettings.DefaultResponse = imageResponse; nChartControl1.RenderControl(null); }
protected void Page_Load(object sender, System.EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Clustered Float Bar"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // configure the chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Axis(StandardAxis.Depth).Visible = false; chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); // setup X axis NOrdinalScaleConfigurator scaleX = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; scaleX.MajorTickMode = MajorTickMode.AutoMaxCount; // add interlace stripe NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Left }; scaleY.StripStyles.Add(stripStyle); // setup the bar series NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.Name = "Bar"; bar.DataLabelStyle.Visible = false; bar.Values.FillRandomRange(Random, 8, 7, 15); // setup the floatbar series NFloatBarSeries floatbar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar); floatbar.MultiFloatBarMode = MultiFloatBarMode.Clustered; floatbar.Name = "Floatbar"; floatbar.DataLabelStyle.Visible = false; floatbar.AddDataPoint(new NFloatBarDataPoint(3.1, 5.2)); floatbar.AddDataPoint(new NFloatBarDataPoint(4.0, 6.1)); floatbar.AddDataPoint(new NFloatBarDataPoint(2.0, 6.4)); floatbar.AddDataPoint(new NFloatBarDataPoint(5.3, 7.3)); floatbar.AddDataPoint(new NFloatBarDataPoint(3.8, 8.4)); floatbar.AddDataPoint(new NFloatBarDataPoint(4.0, 7.7)); floatbar.AddDataPoint(new NFloatBarDataPoint(2.9, 4.1)); floatbar.AddDataPoint(new NFloatBarDataPoint(5.0, 7.2)); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { EnableInitialPositioningCheckBox.Checked = true; EnableLabelAdjustmentCheckBox.Checked = true; HiddenField1.Value = Random.Next().ToString(); } nChartControl1.Settings.JitterMode = JitterMode.Enabled; nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Stack Line Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); // configure the chart NChart chart = nChartControl1.Charts[0]; // configure X axis NOrdinalScaleConfigurator scaleX = new NOrdinalScaleConfigurator(); scaleX.DisplayDataPointsBetweenTicks = false; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // configure Y axis NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator(); scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; scaleY.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY; // add interlaced stripe for Y axis NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleY.StripStyles.Add(stripStyle); // line series 1 NLineSeries series1 = (NLineSeries)chart.Series.Add(SeriesType.Line); series1.Name = "Line 1"; series1.InflateMargins = true; series1.MarkerStyle.Visible = true; series1.MarkerStyle.FillStyle = new NColorFillStyle(DarkOrange); series1.MarkerStyle.PointShape = PointShape.Ellipse; series1.MarkerStyle.Width = new NLength(1.0f, NRelativeUnit.ParentPercentage); series1.MarkerStyle.Height = new NLength(1.0f, NRelativeUnit.ParentPercentage); series1.DataLabelStyle.Visible = true; series1.DataLabelStyle.VertAlign = VertAlign.Top; series1.DataLabelStyle.ArrowLength = new NLength(10); series1.DataLabelStyle.ArrowStrokeStyle.Color = DarkOrange; series1.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = DarkOrange; series1.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8); // line series 2 NLineSeries series2 = (NLineSeries)chart.Series.Add(SeriesType.Line); series2.Name = "Line 2"; series2.InflateMargins = true; series2.MultiLineMode = MultiLineMode.Stacked; series2.MarkerStyle.Visible = true; series2.MarkerStyle.FillStyle = new NColorFillStyle(Green); series2.MarkerStyle.PointShape = PointShape.Pyramid; series2.MarkerStyle.Width = new NLength(1.0f, NRelativeUnit.ParentPercentage); series2.MarkerStyle.Height = new NLength(1.0f, NRelativeUnit.ParentPercentage); series2.DataLabelStyle.Visible = true; series2.DataLabelStyle.VertAlign = VertAlign.Top; series2.DataLabelStyle.ArrowLength = new NLength(10); series2.DataLabelStyle.ArrowStrokeStyle.Color = Green; series2.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = Green; series2.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8); // label layout settings chart.LabelLayout.EnableInitialPositioning = EnableInitialPositioningCheckBox.Checked; chart.LabelLayout.EnableLabelAdjustment = EnableLabelAdjustmentCheckBox.Checked; NSizeL safeguardSize = new NSizeL( new NLength(1.6f, NRelativeUnit.ParentPercentage), new NLength(1.6f, NRelativeUnit.ParentPercentage)); series1.LabelLayout.UseLabelLocations = true; series1.LabelLayout.OutOfBoundsLocationMode = OutOfBoundsLocationMode.PushWithinBounds; series1.LabelLayout.InvertLocationsIfIgnored = true; series1.LabelLayout.EnableDataPointSafeguard = true; series1.LabelLayout.DataPointSafeguardSize = safeguardSize; series2.LabelLayout.UseLabelLocations = true; series2.LabelLayout.OutOfBoundsLocationMode = OutOfBoundsLocationMode.PushWithinBounds; series2.LabelLayout.InvertLocationsIfIgnored = true; series2.LabelLayout.EnableDataPointSafeguard = true; series2.LabelLayout.DataPointSafeguardSize = safeguardSize; // fill with random data GenerateData(chart); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Axis Ruler Caps<br/> <font size = '9pt'>Demonstrates how to change the caps of the axis ruler</font>"); header.DockMode = PanelDockMode.Top; header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.TextStyle.TextFormat = TextFormat.XML; header.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Left; header.FitAlignment = ContentAlignment.MiddleLeft; header.Margins = new NMarginsL(5, 0, 0, 5); nChartControl1.Panels.Add(header); NCartesianChart chart = new NCartesianChart(); chart.DockMode = PanelDockMode.Fill; chart.BoundsMode = BoundsMode.Stretch; chart.Margins = new NMarginsL(5, 10, 10, 5); nChartControl1.Panels.Add(chart); Random random = new Random(); // feed some random data NPointSeries point = new NPointSeries(); point.DataLabelStyle.Visible = false; point.UseXValues = true; point.Size = new NLength(5); point.BorderStyle.Width = new NLength(0); // fill in some random data for (int j = 0; j < 30; j++) { point.Values.Add(5 + random.Next(90)); point.XValues.Add(5 + random.Next(90)); } chart.Series.Add(point); // configure scales NLinearScaleConfigurator xScale = new NLinearScaleConfigurator(); xScale.RoundToTickMax = true; xScale.RoundToTickMin = true; xScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); xScale.ScaleBreaks.Add(new NCustomScaleBreak(new NLineScaleBreakStyle(new NColorFillStyle(Color.FromArgb(124, Color.Orange)), null, new NLength(10)), new NRange1DD(29, 41))); // add an interlaced strip to the X axis NScaleStripStyle xInterlacedStrip = new NScaleStripStyle(); xInterlacedStrip.SetShowAtWall(ChartWallType.Back, true); xInterlacedStrip.Interlaced = true; xInterlacedStrip.FillStyle = new NColorFillStyle(Color.FromArgb(40, Color.LightGray)); xScale.StripStyles.Add(xInterlacedStrip); NCartesianAxis xAxis = (NCartesianAxis)chart.Axis(StandardAxis.PrimaryX); xAxis.ScaleConfigurator = xScale; xAxis.View = new NRangeAxisView(new NRange1DD(0, 100)); NDockAxisAnchor xAxisAnchor = new NDockAxisAnchor(AxisDockZone.FrontBottom); xAxisAnchor.BeforeSpace = new NLength(10); xAxis.Anchor = xAxisAnchor; NLinearScaleConfigurator yScale = new NLinearScaleConfigurator(); yScale.RoundToTickMax = true; yScale.RoundToTickMin = true; yScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); yScale.ScaleBreaks.Add(new NCustomScaleBreak(new NLineScaleBreakStyle(new NColorFillStyle(Color.FromArgb(124, Color.Orange)), null, new NLength(10)), new NRange1DD(29, 41))); // add an interlaced strip to the Y axis NScaleStripStyle yInterlacedStrip = new NScaleStripStyle(); yInterlacedStrip.SetShowAtWall(ChartWallType.Back, true); yInterlacedStrip.Interlaced = true; yInterlacedStrip.FillStyle = new NColorFillStyle(Color.FromArgb(40, Color.LightGray)); yScale.StripStyles.Add(yInterlacedStrip); NCartesianAxis yAxis = (NCartesianAxis)chart.Axis(StandardAxis.PrimaryY); yAxis.ScaleConfigurator = yScale; yAxis.View = new NRangeAxisView(new NRange1DD(0, 100)); NDockAxisAnchor yAxisAnchor = new NDockAxisAnchor(AxisDockZone.FrontLeft); yAxisAnchor.BeforeSpace = new NLength(10); yAxis.Anchor = yAxisAnchor; // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // update form controls if (!IsPostBack) { PaintOnScaleBreaksCheckBox.Checked = false; WebExamplesUtilities.FillComboWithEnumValues(BeginCapStyleDropDownList, typeof(CapStyle)); BeginCapStyleDropDownList.SelectedIndex = (int)CapStyle.Ellipse; WebExamplesUtilities.FillComboWithEnumValues(ScaleBreakCapStyleDropDownList, typeof(CapStyle)); ScaleBreakCapStyleDropDownList.SelectedIndex = (int)CapStyle.LeftCrossLine; WebExamplesUtilities.FillComboWithEnumValues(EndCapStyleDropDownList, typeof(CapStyle)); EndCapStyleDropDownList.SelectedIndex = (int)CapStyle.Arrow; } UpdateRulerStyleForAxis(xAxis); UpdateRulerStyleForAxis(yAxis); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Date Time Scale"); title.TextStyle.TextFormat = TextFormat.XML; 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)); // no legend nChartControl1.Legends.Clear(); // setup chart m_Chart = (NCartesianChart)nChartControl1.Charts[0]; m_Chart.BoundsMode = BoundsMode.Stretch; // add a range selection, snapped to the vertical axis min/max values NRangeSelection rangeSelection = new NRangeSelection(); rangeSelection.VerticalValueSnapper = new NAxisRulerMinMaxSnapper(); m_Chart.RangeSelections.Add(rangeSelection); // add interlaced stripe to the Y axis NLinearScaleConfigurator linearScale = m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.StripStyles.Add(stripStyle); // Add a line series NLineSeries line = (NLineSeries)m_Chart.Series.Add(SeriesType.Line); line.UseXValues = true; line.DataLabelStyle.Visible = false; line.InflateMargins = true; line.MarkerStyle.Visible = true; line.MarkerStyle.BorderStyle.Color = Color.DarkRed; line.MarkerStyle.PointShape = PointShape.Cylinder; line.MarkerStyle.Width = new NLength(2, NRelativeUnit.ParentPercentage); line.MarkerStyle.Height = new NLength(2, NRelativeUnit.ParentPercentage); // create a date time scale NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); m_DateTimeScale = dateTimeScale; m_DateTimeScale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 90); m_DateTimeScale.LabelStyle.ContentAlignment = ContentAlignment.MiddleLeft; m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale; // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); NAxis xAxis = m_Chart.Axis(StandardAxis.PrimaryX); xAxis.ScrollBar.Visible = true; // configure interactivity nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NAxisScrollTool()); nChartControl1.Controller.Tools.Add(new NDataZoomTool()); // init form controls EndDateTimePicker.Value = CultureInfo.CurrentCulture.Calendar.AddYears(StartDateTimePicker.Value, 2); EnableUnitSensitiveFormattingCheckBox.Checked = true; DayCheckBox.Checked = true; WeekCheckBox.Checked = true; MonthCheckBox.Checked = true; QuarterCheckBox.Checked = true; YearCheckBox.Checked = true; UpdateDateTimeScale(); GenerateDataButton_Click(null, null); nChartControl1.Refresh(); }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel header = nChartControl1.Labels.AddHeader("Date Time Scale"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL( new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; // add a strip line style NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); NScaleStripStyle stripStyle = new NScaleStripStyle(); stripStyle.FillStyle = new NColorFillStyle(Color.Beige); stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); stripStyle.Interlaced = true; linearScale.StripStyles.Add(stripStyle); chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale; // create line serie and dispay them on vertical axis NLineSeries line = new NLineSeries(); chart.Series.Add(line); line.UseXValues = true; line.Name = "Line"; line.DataLabelStyle.Visible = false; line.InflateMargins = true; NTimeSpanScaleConfigurator timeSpanScale = new NTimeSpanScaleConfigurator(); timeSpanScale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.View, 90); timeSpanScale.LabelStyle.ContentAlignment = ContentAlignment.MiddleLeft; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = timeSpanScale; chart.BoundsMode = BoundsMode.Stretch; chart.Location = new NPointL( new NLength(5, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL( new NLength(85, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage)); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); if (!IsPostBack) { SampleTimeRangeDropDownList.Items.Add("Milliseconds"); SampleTimeRangeDropDownList.Items.Add("Seconds"); SampleTimeRangeDropDownList.Items.Add("Minutes"); SampleTimeRangeDropDownList.Items.Add("Hours"); SampleTimeRangeDropDownList.Items.Add("Days"); SampleTimeRangeDropDownList.Items.Add("Weeks"); SampleTimeRangeDropDownList.SelectedIndex = 2; // minutes EnableUnitSensitiveFormattingCheckBox.Checked = true; } UpdateTimeSpanScale(timeSpanScale); FillDummyData(line); }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Surface With Empty Data Points"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // setup legend NLegend legend = nChartControl1.Legends[0]; legend.VerticalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.HorizontalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.OuterBottomBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.OuterLeftBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.OuterRightBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.OuterTopBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.FillStyle = new NColorFillStyle(Color.Transparent); legend.Data.MarkSize = new NSizeL( new NLength(8, NGraphicsUnit.Pixel), new NLength(8, NGraphicsUnit.Pixel)); // setup chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Projection.Type = ProjectionType.Perspective; chart.Projection.Elevation = 28; chart.Projection.Rotation = -18; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft); chart.Width = 70.0f; chart.Depth = 70.0f; chart.Height = 30.0f; if (IsPostBack) { chart.Projection.Rotation = (float)Convert.ToDouble(RotationTextBox.Text); chart.Projection.Elevation = (float)Convert.ToDouble(ElevationTextBox.Text); } else { RotationTextBox.Text = chart.Projection.Rotation.ToString(); ElevationTextBox.Text = chart.Projection.Elevation.ToString(); smoothShadingCheck.Checked = true; } // setup Y axis NLinearScaleConfigurator linearScaleConfigurator = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScaleConfigurator.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 8); // add interlace stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); linearScaleConfigurator.StripStyles.Add(stripStyle); // setup X axis NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator(); scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Back }; scaleX.RoundToTickMin = false; scaleX.RoundToTickMax = false; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // setup Z axis NLinearScaleConfigurator scaleZ = new NLinearScaleConfigurator(); scaleZ.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Left }; scaleZ.RoundToTickMin = false; scaleZ.RoundToTickMax = false; chart.Axis(StandardAxis.Depth).ScaleConfigurator = scaleZ; // add the surface series NGridSurfaceSeries surface = (NGridSurfaceSeries)chart.Series.Add(SeriesType.GridSurface); surface.Name = "Surface"; surface.Legend.Mode = SeriesLegendMode.SeriesLogic; surface.Legend.TextStyle.FontStyle.EmSize = new NLength(8, NGraphicsUnit.Point); surface.PositionValue = 10.0; surface.Data.SetGridSize(40, 40); surface.SyncPaletteWithAxisScale = false; surface.PaletteSteps = 8; surface.ValueFormatter.FormatSpecifier = "0.0"; FillData(surface); if (smoothShadingCheck.Checked) { surface.ShadingMode = ShadingMode.Smooth; } else { surface.ShadingMode = ShadingMode.Flat; } // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, legend); }
public override void Initialize() { base.Initialize(); NChart chart = nChartControl1.Charts[0]; nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("XYZ Stack Bar"); 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)); // set predefined projection and lighting chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.BrightCameraLight); chart.Width = 50; chart.Height = 35; chart.Depth = 50; chart.Enable3D = true; // configure the axes NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); linearScale = new NLinearScaleConfigurator(); chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); // add interlace stripes to the Y axis NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); stripStyle.Interlaced = true; linearScale.StripStyles.Add(stripStyle); linearScale = new NLinearScaleConfigurator(); chart.Axis(StandardAxis.Depth).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); AddBarSeries(chart, MultiBarMode.Series); AddBarSeries(chart, MultiBarMode.Stacked); AddBarSeries(chart, MultiBarMode.Stacked); AddBarSeries(chart, MultiBarMode.Stacked); // apply layout ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); GenerateData(); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = new NLabel("XY Bars"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); // configure the chart m_Chart = nChartControl1.Charts[0]; m_Chart.Enable3D = true; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalHalf); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); m_Chart.Axis(StandardAxis.Depth).Visible = false; // switch the categories axis in numeric mode m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator(); // add interlaced stripe NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); stripStyle.Interlaced = true; linearScale.StripStyles.Add(stripStyle); m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale; // create the shape series m_Shape = (NShapeSeries)m_Chart.Series.Add(SeriesType.Shape); // show information about the data points in the legend m_Shape.Legend.Mode = SeriesLegendMode.DataPoints; // show the Y size and label in the legend m_Shape.Legend.Format = "<ysize> <label>"; // show the Y size and label in the data point labels m_Shape.DataLabelStyle.Format = "<ysize> <label>"; // use custom X positions m_Shape.UseXValues = true; // X sizes are specified in Model units (the default is Scale) // this will make the bars size independant from the scale of the X axis m_Shape.XSizesUnits = MeasurementUnits.Model; // this will require to set the InflateMargins flag to true since in this mode // scale is determined only by the X positions of the shape and will not take // into account the size of the bars. m_Shape.InflateMargins = true; // position all shapes at the series Z order m_Shape.UseZValues = false; // add the bars // add Bar1 m_Shape.AddDataPoint(new NShapeDataPoint( 10, // Y center of bar -> half its Y size 12, // X position 0, // Z position - not used since UseZValue is set to false 10, // X size - 10 model units 20, // Y size of bar 0.66, // Z size - 2 thirds of series depth "Bar1", // label new NColorFillStyle(Color.LightGreen) )); // add Bar2 m_Shape.AddDataPoint(new NShapeDataPoint( 20, // Y center of bar -> half its Y size 34, // X position - not used since UseXValue is set to false 0, // Z position - not used since UseZValue is set to false 10, // X size - 10 model units 40, // Y size of bar 0.33, // Z size - 1 third of series depth "Bar2", // label new NColorFillStyle(Color.LightCoral) )); // add Bar3 m_Shape.AddDataPoint(new NShapeDataPoint( 15, // Y center of bar -> half its Y size 50, // X position - not used since UseXValue is set to false 0, // Z position - not used since UseZValue is set to false 10, // X size - 10 model units 30, // Y size of bar 0.5, // Z size - half series depth "Bar3", // label new NColorFillStyle(Color.LightSalmon) )); // apply layout ConfigureStandardLayout(m_Chart, title, nChartControl1.Legends[0]); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); // init form controls InflateMarginsCheckBox.Checked = true; AxesRoundToTickCheck.Checked = true; StyleCombo.SelectedIndex = 0; }
public override void Initialize() { base.Initialize(); // configure the trackball NTrackballTool trackballTool = new NTrackballTool(); trackballTool.ProjectionChanged += new EventHandler(OnProjectionChanged); nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(trackballTool); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Axis Labels Orientation"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.DockMode = PanelDockMode.Top; title.Margins = new NMarginsL(10, 10, 10, 10); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); title.SendToBack(); // no legend nChartControl1.Legends.Clear(); // setup the chart m_Chart = (NCartesianChart)nChartControl1.Charts[0]; m_Chart.Enable3D = true; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); m_Chart.Depth = 50; m_Chart.Width = 50; m_Chart.Height = 50; m_Chart.BorderStyle = new NStrokeBorderStyle(BorderShape.RoundedRect); m_Chart.BoundsMode = BoundsMode.Fit; m_Chart.DockMode = PanelDockMode.Fill; m_Chart.Margins = new NMarginsL(30, 0, 30, 30); m_Chart.Padding = new NMarginsL(5, 5, 5, 5); m_Chart.BackgroundFillStyle = new NGradientFillStyle(Color.White, Color.LightGray); // setup Y axis NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator(); scaleY.Title.Text = "Values"; // add interlaced stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Left }; stripStyle.Interlaced = true; scaleY.StripStyles.Add(stripStyle); m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY; // configure the x axis labels (categories) NOrdinalScaleConfigurator scaleX = (NOrdinalScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; scaleX.AutoLabels = false; scaleX.Title.Text = "Categories Title"; scaleX.MajorTickMode = MajorTickMode.CustomStep; scaleX.LabelFitModes = new LabelFitMode[] { LabelFitMode.Stagger2, LabelFitMode.AutoScale }; for (int j = 0; j < categoriesCount; j++) { scaleX.Labels.Add("Category " + j.ToString()); } // configure the depth axis labels (series) NOrdinalScaleConfigurator scaleZ = m_Chart.Axis(StandardAxis.Depth).ScaleConfigurator as NOrdinalScaleConfigurator; scaleZ.AutoLabels = false; scaleZ.Title.Text = "Series Title"; scaleZ.MajorTickMode = MajorTickMode.CustomStep; scaleZ.Labels.Add("Series 1"); scaleZ.Labels.Add("Series 2"); scaleZ.Labels.Add("Series 3"); scaleZ.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); scaleZ.LabelFitModes = new LabelFitMode[] { LabelFitMode.Stagger2, LabelFitMode.AutoScale }; // add series for (int i = 0; i < 3; i++) { NBarSeries bar = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar); bar.InflateMargins = true; bar.BarShape = BarShape.SmoothEdgeBar; bar.DataLabelStyle.Visible = false; bar.Name = "Series " + i.ToString(); bar.Values.FillRandomRange(Random, categoriesCount, 10, 30); } // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); // initialize controls on the form AngleModeComboBox.FillFromEnum(typeof(ScaleLabelAngleMode)); AngleModeComboBox.SelectedIndex = (int)ScaleLabelAngleMode.Scale; Use3DCheckBox.Checked = true; OnProjectionChanged(null, null); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Axis Value Crossing <br/> <font size = '9pt'>Demonstrates how to use of the value cross anchor</font>"); title.TextStyle.TextFormat = TextFormat.XML; 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)); // turn off the legend nChartControl1.Legends[0].Mode = LegendMode.Disabled; m_Chart = nChartControl1.Charts[0]; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.NorthernLights); // configure scales NLinearScaleConfigurator yScaleConfigurator = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; NScaleStripStyle yStripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(40, Color.LightGray)), null, true, 0, 0, 1, 1); yStripStyle.SetShowAtWall(ChartWallType.Back, true); yStripStyle.Interlaced = true; yScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); yScaleConfigurator.StripStyles.Add(yStripStyle); NLinearScaleConfigurator xScaleConfigurator = new NLinearScaleConfigurator(); NScaleStripStyle xStripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(40, Color.LightGray)), null, true, 0, 0, 1, 1); xStripStyle.SetShowAtWall(ChartWallType.Back, true); xStripStyle.Interlaced = true; xScaleConfigurator.StripStyles.Add(xStripStyle); xScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = xScaleConfigurator; // cross X and Y axes m_Chart.Axis(StandardAxis.PrimaryX).Anchor = new NCrossAxisAnchor(AxisOrientation.Horizontal, new NValueAxisCrossing(m_Chart.Axis(StandardAxis.PrimaryY), 0)); m_Chart.Axis(StandardAxis.PrimaryX).Anchor.RulerOrientation = RulerOrientation.Right; m_Chart.Axis(StandardAxis.PrimaryY).Anchor = new NCrossAxisAnchor(AxisOrientation.Vertical, new NValueAxisCrossing(m_Chart.Axis(StandardAxis.PrimaryX), 0)); m_Chart.Axis(StandardAxis.Depth).Visible = false; m_Chart.Wall(ChartWallType.Floor).Visible = false; m_Chart.Wall(ChartWallType.Left).Visible = false; // setup bubble series NBubbleSeries bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); bubble.Name = "Bubble Series"; bubble.InflateMargins = true; bubble.DataLabelStyle.Visible = false; bubble.UseXValues = true; bubble.BubbleShape = PointShape.Sphere; // fill with random data bubble.Values.FillRandomRange(Random, 10, -20, 20); bubble.XValues.FillRandomRange(Random, 10, -20, 20); bubble.Sizes.FillRandomRange(Random, 10, 1, 6); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); // init form controls LeftAxisScroll.Minimum = -30; LeftAxisScroll.Maximum = 30; LeftAxisScroll.Value = 0; BottomAxisScroll.Minimum = -30; BottomAxisScroll.Maximum = 30; BottomAxisScroll.Value = 0; LeftAxisLabel.Text = LeftAxisScroll.Value.ToString(); BottomAxisLabel.Text = BottomAxisScroll.Value.ToString(); LeftUsePositionCheck.Checked = true; BottomUsePositionCheck.Checked = true; }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Moving Averages"); 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)); // setup chart m_Chart = nChartControl1.Charts[0]; m_Chart.BoundsMode = BoundsMode.Stretch; m_Chart.Location = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); m_Chart.Size = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(75, NRelativeUnit.ParentPercentage)); // setup X axis NRangeTimelineScaleConfigurator scaleX = new NRangeTimelineScaleConfigurator(); scaleX.FirstRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.FirstRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(225, 225, 225)); scaleX.FirstRow.UseGridStyle = true; scaleX.SecondRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.SecondRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(215, 215, 215)); scaleX.SecondRow.UseGridStyle = true; scaleX.ThirdRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.ThirdRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(205, 205, 205)); scaleX.ThirdRow.UseGridStyle = true; // calendar NWeekDayRule wdr = new NWeekDayRule(WeekDayBit.All); wdr.Saturday = false; wdr.Sunday = false; scaleX.Calendar.Rules.Add(wdr); scaleX.EnableCalendar = true; // set configurator m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // setup Y axis NAxis axis = m_Chart.Axis(StandardAxis.PrimaryY); NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)axis.ScaleConfigurator; linearScale.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; linearScale.InnerMajorTickStyle.Length = new NLength(0); // line series for the function m_Line = (NLineSeries)m_Chart.Series.Add(SeriesType.Line); m_Line.DataLabelStyle.Visible = false; m_Line.BorderStyle.Color = Color.Crimson; m_Line.BorderStyle.Width = new NLength(2, NGraphicsUnit.Pixel); m_Line.UseXValues = true; Color customColor = Color.FromArgb(100, 100, 150); // setup the stock series m_Stock = (NStockSeries)m_Chart.Series.Add(SeriesType.Stock); m_Stock.DataLabelStyle.Visible = false; m_Stock.CandleStyle = CandleStyle.Bar; m_Stock.HighLowStrokeStyle.Color = customColor; m_Stock.UpStrokeStyle.Color = customColor; m_Stock.DownStrokeStyle.Color = customColor; m_Stock.UpFillStyle = new NColorFillStyle(Color.White); m_Stock.DownFillStyle = new NColorFillStyle(customColor); m_Stock.Legend.Mode = SeriesLegendMode.None; m_Stock.OpenValues.Name = "open"; m_Stock.HighValues.Name = "high"; m_Stock.LowValues.Name = "low"; m_Stock.CloseValues.Name = "close"; m_Stock.CandleWidth = new NLength(1, NRelativeUnit.ParentPercentage); m_Stock.InflateMargins = true; m_Stock.UseXValues = true; GenerateData(); // form controls m_bSkipUpdate = true; m_ApplyToCombo.SelectedIndex = 3; m_bSkipUpdate = false; m_FunctionCombo.Items.Add("Simple Moving Average"); m_FunctionCombo.Items.Add("Weighted Moving Average"); m_FunctionCombo.Items.Add("Exponential Moving Average"); m_FunctionCombo.Items.Add("Modified Moving Average"); m_FunctionCombo.SelectedIndex = 0; }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Linear Scale"); 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)); // setup chart m_Chart = nChartControl1.Charts[0]; m_Chart.BoundsMode = BoundsMode.Stretch; m_Chart.Location = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(10, NRelativeUnit.ParentPercentage)); m_Chart.Size = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage)); m_Chart.Axis(StandardAxis.Depth).Visible = false; // configure the y axis NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); // add a strip line style NScaleStripStyle stripStyle = new NScaleStripStyle(); stripStyle.FillStyle = new NColorFillStyle(Color.Beige); stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); stripStyle.Interlaced = true; linearScale.StripStyles.Add(stripStyle); m_Line = (NLineSeries)m_Chart.Series.Add(SeriesType.Line); m_Line.Legend.Mode = SeriesLegendMode.None; m_Line.InflateMargins = false; m_Line.MarkerStyle.Visible = true; m_Line.MarkerStyle.PointShape = PointShape.Ellipse; m_Line.MarkerStyle.Width = new NLength(5, NGraphicsUnit.Point); m_Line.MarkerStyle.Height = new NLength(5, NGraphicsUnit.Point); m_Line.MarkerStyle.AutoDepth = true; m_Line.DataLabelStyle.Format = "<value>"; m_Line.DataLabelStyle.ArrowStrokeStyle.Color = Color.CornflowerBlue; m_Line.Values.FillRandomRange(Random, 10, 0, 100); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // update controls AutoMinDistanceRadioButton.Checked = true; MaxCountUpDown.Value = (decimal)linearScale.MaxTickCount; MinDistanceUpDown.Value = (decimal)linearScale.MinTickDistance.Value; CustomStepUpDown.Value = (decimal)linearScale.CustomStep; m_Updating = false; UpdateScale(); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Real Time Area"); 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)); // no legend nChartControl1.Legends.Clear(); // configure the chart NChart chart = nChartControl1.Charts[0]; chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); chart.BoundsMode = BoundsMode.Stretch; // configure the y axis NAxis yAxis = chart.Axis(StandardAxis.PrimaryY); yAxis.View = new NRangeAxisView(new NRange1DD(0, 100)); NLinearScaleConfigurator linearScale = yAxis.ScaleConfigurator as NLinearScaleConfigurator; // add interlace stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.StripStyles.Add(stripStyle); linearScale.MajorGridStyle.LineStyle.Color = Color.LightSteelBlue; linearScale.InnerMinorTickStyle.Visible = false; linearScale.InnerMajorTickStyle.Visible = false; linearScale.LabelFitModes = new LabelFitMode[0]; // configure the x axis NAxis xAxis = chart.Axis(StandardAxis.PrimaryX); linearScale = new NLinearScaleConfigurator(); linearScale.LabelFitModes = new LabelFitMode[0]; xAxis.ScaleConfigurator = linearScale; linearScale.RoundToTickMax = false; linearScale.RoundToTickMin = false; linearScale.InnerMinorTickStyle.Visible = false; linearScale.InnerMajorTickStyle.Visible = false; chart.Axis(StandardAxis.Depth).Visible = false; // add the first line NAreaSeries area = new NAreaSeries(); chart.Series.Add(area); area.SamplingMode = SeriesSamplingMode.Enabled; area.UseXValues = true; area.DataLabelStyle.Visible = false; area.Values.ValueFormatter = new NNumericValueFormatter("0.0"); area.Values.EmptyDataPoints.ValueMode = EmptyDataPointsValueMode.Skip; // apply layout ConfigureStandardLayout(chart, title, null); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // turn off area border to improve performance after you apply the style sheet area.BorderStyle.Width = new NLength(0); NumberOfDataPointsComboBox.Items.Add("1000"); NumberOfDataPointsComboBox.Items.Add("5000"); NumberOfDataPointsComboBox.Items.Add("10000"); NumberOfDataPointsComboBox.SelectedIndex = 0; NewDataPointsPerTickComboBox.Items.Add("10"); NewDataPointsPerTickComboBox.Items.Add("50"); NewDataPointsPerTickComboBox.Items.Add("100"); NewDataPointsPerTickComboBox.SelectedIndex = 1; UseHardwareAccelerationCheckBox.Checked = true; StartTimer(); }
protected void Page_Load(object sender, System.EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Panels.Clear(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Custom Scale Decorations 2"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; title.Margins = new NMarginsL(10, 10, 10, 10); title.DockMode = PanelDockMode.Top; NCartesianChart chart = new NCartesianChart(); nChartControl1.Panels.Add(chart); chart.BoundsMode = BoundsMode.Stretch; chart.DockMode = PanelDockMode.Fill; chart.Margins = new NMarginsL(10, 0, 10, 10); chart.BackgroundFillStyle = new NColorFillStyle(Color.FromArgb(231, 231, 233)); chart.MaxDockZoneMargins = new NMarginsL(100000, 100000, 100000, 100000); NStrokeBorderStyle strokeBorder = new NStrokeBorderStyle(); strokeBorder.StrokeStyle.Color = Color.FromArgb(192, 192, 192); chart.BorderStyle = strokeBorder; int dpCount = 4; double[] bar1Values = new double[dpCount]; double[] bar2Values = new double[dpCount]; NLabelInfo[] xLabels = new NLabelInfo[dpCount]; // add some dummy data Random rand = new Random(); for (int i = 0; i < dpCount; i++) { bar1Values[i] = rand.Next(100); bar2Values[i] = rand.Next(100); xLabels[i] = new NLabelInfo(i, "Label" + i.ToString(), Color.FromArgb(100, 100, 100), i % 2 == 0 ? Color.Red : Color.Orange); } NLabelInfo[] yLabels = new NLabelInfo[9]; for (int i = 0; i < 9; i++) { yLabels[i].Text = ((i + 1) * 10).ToString() + "%"; yLabels[i].Value = (i + 1) * 10; yLabels[i].ForeColor = Color.FromArgb(100, 100, 100); yLabels[i].BackColor = Color.Transparent; } // add two bars series in cluster mode NBarSeries bar1 = new NBarSeries(); bar1.Values.AddRange(bar1Values); bar1.DataLabelStyle.Visible = false; bar1.MultiBarMode = MultiBarMode.Clustered; bar1.FillStyle = new NColorFillStyle(Color.FromArgb(21, 153, 215)); bar1.FillStyle.ImageFiltersStyle.Filters.Add(new NBevelAndEmbossImageFilter()); bar1.WidthPercent = 50; bar1.GapPercent = 20; chart.Series.Add(bar1); NBarSeries bar2 = new NBarSeries(); bar2.Values.AddRange(bar2Values); bar2.DataLabelStyle.Visible = false; bar2.MultiBarMode = MultiBarMode.Clustered; bar2.FillStyle = new NColorFillStyle(Color.FromArgb(113, 127, 138)); bar2.FillStyle.ImageFiltersStyle.Filters.Add(new NBevelAndEmbossImageFilter()); bar2.WidthPercent = 50; bar2.GapPercent = 20; chart.Series.Add(bar2); // add custom labels to the x axis NLinearScaleConfigurator xScale = new NLinearScaleConfigurator(); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = xScale; chart.Axis(StandardAxis.PrimaryX).View = new NRangeAxisView(new NRange1DD(-0.5, xLabels.Length - 0.5), true, true); xScale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.FromArgb(100, 100, 100)); xScale.AutoLabels = false; xScale.OuterMajorTickStyle.Visible = false; xScale.InnerMajorTickStyle.Visible = false; xScale.LabelStyle.Offset = new NLength(10); xScale.RulerStyle.BorderStyle.Width = new NLength(0); xScale.RulerStyle.Height = new NLength(0); NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(240, 240, 240)), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); xScale.StripStyles.Add(stripStyle); // hide the back wall chart.Wall(ChartWallType.Back).Visible = false; // configure the Y axis chart.Axis(StandardAxis.PrimaryY).View = new NRangeAxisView(new NRange1DD(0, 100), true, true); NLinearScaleConfigurator yScale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; yScale.AutoLabels = false; yScale.MajorTickMode = MajorTickMode.CustomTicks; yScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); yScale.MajorGridStyle.LineStyle.Color = Color.FromArgb(192, 192, 192); yScale.OuterMajorTickStyle.Visible = false; yScale.InnerMajorTickStyle.Visible = false; yScale.RulerStyle.BorderStyle.Width = new NLength(0); yScale.RulerStyle.Height = new NLength(0); yScale.CreateNewLevelForCustomLabels = true; // add labels NAxis xAxis = chart.Axis(StandardAxis.PrimaryX); NAxis yAxis = chart.Axis(StandardAxis.PrimaryY); AddLabels(xAxis, true, xLabels); AddLabels(yAxis, true, yLabels); // create cross NCustomWallDecorator xDecorator = new NCustomWallDecorator(); xDecorator.WallDecorations.Add(new NGridLine(-0.5, new NStrokeStyle(Color.FromArgb(190, 190, 190)), new ChartWallType[] { ChartWallType.Back }, true)); xAxis.Scale.WallDecorators.Add(xDecorator); NCustomWallDecorator yDecorator = new NCustomWallDecorator(); yDecorator.WallDecorations.Add(new NGridLine(0, new NStrokeStyle(Color.FromArgb(190, 190, 190)), new ChartWallType[] { ChartWallType.Back }, true)); yAxis.Scale.WallDecorators.Add(yDecorator); }
private void Init2dGraph() { nChartControl1.Settings.ShapeRenderingMode = ShapeRenderingMode.HighQuality; nChartControl1.Legends.Clear(); // no legend NChart chart2d = nChartControl1.Charts[0]; NSmoothLineSeries surface = null; if (chart2d.Series.Count == 0) { surface = (NSmoothLineSeries)chart2d.Series.Add(SeriesType.SmoothLine); } else { surface = (NSmoothLineSeries)chart2d.Series[0]; } chart2d.BoundsMode = BoundsMode.Stretch; NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart2d.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.StripStyles.Add(stripStyle); NSmoothLineSeries line = null; if (chart2d.Series.Count == 0) { line = (NSmoothLineSeries)chart2d.Series.Add(SeriesType.SmoothLine); } else { line = (NSmoothLineSeries)chart2d.Series[0]; } line.Name = "Power (bhp)"; line.Legend.Mode = SeriesLegendMode.Series; line.UseXValues = true; line.UseZValues = false; line.DataLabelStyle.Visible = true; line.Values.ValueFormatter = new Nevron.Dom.NNumericValueFormatter("0"); line.MarkerStyle.Visible = true; line.MarkerStyle.PointShape = PointShape.Sphere; line.MarkerStyle.AutoDepth = true; line.MarkerStyle.Width = new NLength(1.4f, NRelativeUnit.ParentPercentage); line.MarkerStyle.Height = new NLength(1.4f, NRelativeUnit.ParentPercentage); line.MarkerStyle.Depth = new NLength(1.4f, NRelativeUnit.ParentPercentage); //line.HorizontalAxes = y_axisvalues; NSmoothLineSeries line2 = null; if (chart2d.Series.Count == 1) { line2 = (NSmoothLineSeries)chart2d.Series.Add(SeriesType.SmoothLine); } else { line2 = (NSmoothLineSeries)chart2d.Series[1]; } line2.Name = "Torque (Nm)"; line2.Legend.Mode = SeriesLegendMode.Series; line2.UseXValues = true; line2.UseZValues = false; line2.Values.ValueFormatter = new Nevron.Dom.NNumericValueFormatter("0"); line2.MarkerStyle.Visible = true; line2.MarkerStyle.PointShape = PointShape.Sphere; line2.MarkerStyle.AutoDepth = true; line2.MarkerStyle.Width = new NLength(1.4f, NRelativeUnit.ParentPercentage); line2.MarkerStyle.Height = new NLength(1.4f, NRelativeUnit.ParentPercentage); line2.MarkerStyle.Depth = new NLength(1.4f, NRelativeUnit.ParentPercentage); NSmoothLineSeries line3 = null; if (chart2d.Series.Count == 2) { line3 = (NSmoothLineSeries)chart2d.Series.Add(SeriesType.SmoothLine); } else { line3 = (NSmoothLineSeries)chart2d.Series[2]; } line3.Name = "Injector DC"; line3.Legend.Mode = SeriesLegendMode.Series; line3.UseXValues = true; line3.UseZValues = false; line3.DataLabelStyle.Visible = true; line3.Values.ValueFormatter = new Nevron.Dom.NNumericValueFormatter("0.0"); line3.MarkerStyle.Visible = true; line3.MarkerStyle.PointShape = PointShape.Sphere; line3.MarkerStyle.AutoDepth = true; line3.MarkerStyle.Width = new NLength(1.4f, NRelativeUnit.ParentPercentage); line3.MarkerStyle.Height = new NLength(1.4f, NRelativeUnit.ParentPercentage); line3.MarkerStyle.Depth = new NLength(1.4f, NRelativeUnit.ParentPercentage); surface.Name = "Surface"; //surface.Legend.Mode = SeriesLegendMode.SeriesLogic; //surface.PositionValue = 10.0; for (int i = 0; i < x_axisvalues.Length; i++) { surface.XValues.Add(x_axisvalues.GetValue(i)); } NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Nevron); styleSheet.Apply(nChartControl1.Document); }
/// <summary> /// Configures the axis /// </summary> /// <param name="chart">Nevron chart</param> /// <param name="stats">Chart stats, and configuration details.</param> void SetupChartAxes(NChart chart, IAttributeChartStats stats) { NAxis axisY1 = chart.Axis(StandardAxis.PrimaryY); NAxis axisY2 = chart.Axis(StandardAxis.SecondaryY); NAxis axisX = chart.Axis(StandardAxis.PrimaryX); NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator(); scaleX.MajorGridStyle.LineStyle.Pattern = LinePattern.Dash; scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.InnerMajorTickStyle.Visible = false; scaleX.Title.Text = stats.TimeLabel; scaleX.Title.TextStyle.FontStyle = new NFontStyle("Arial", 9, FontStyle.Bold); scaleX.ViewRangeInflateMode = ScaleViewRangeInflateMode.Logical; scaleX.LogicalInflate = new NRange1DD(0.5, 0.5); axisX.ScaleConfigurator = scaleX; NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator(); scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dash; scaleY.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleY.InnerMajorTickStyle.Visible = false; scaleY.Title.Text = stats.DefectLabel; scaleY.Title.TextStyle.FontStyle = new NFontStyle("Arial", 9, FontStyle.Bold); axisY1.ScaleConfigurator = scaleY; NLinearScaleConfigurator scaleY2 = new NLinearScaleConfigurator(); scaleY2.OuterMajorTickStyle.Visible = false; scaleY2.InnerMajorTickStyle.Visible = false; scaleY2.RulerStyle.BorderStyle.Width = new NLength(0); scaleY2.AutoLabels = false; axisY2.ScaleConfigurator = scaleY2; axisY2.Visible = true; // the scale of the secodary Y axis must be the same as the primary Y axis scale axisY1.Slaves.Add(axisY2); }
private void callPersonalGraph(string projectName, string ScenarioName, int idx) { nChartControl1.Clear(); //rData.getRData()[0].taskName 이런식으로 인덱스 줘서 사용하면 될 듯 m_FuncCalculator = new NFunctionCalculator(); nChartControl1.Legends.Clear(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Task x 소요 시간"); //title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Regular); title.TextStyle.FontStyle = new NFontStyle(pfc.Families[0].ToString(), 18, FontStyle.Regular); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // setup chart m_Chart = nChartControl1.Charts[0]; m_Chart.BoundsMode = BoundsMode.Stretch; m_Chart.Location = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); m_Chart.Size = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(75, NRelativeUnit.ParentPercentage)); //m_Chart.Axis(StandardAxis.Depth).Visible = false; // add a line series for the function m_Line = (NLineSeries)m_Chart.Series.Add(SeriesType.Line); m_Line.MarkerStyle.Visible = true; m_Line.MarkerStyle.BorderStyle.Color = Color.DarkGreen; m_Line.MarkerStyle.BorderStyle.Width = new NLength(2, NGraphicsUnit.Pixel); m_Line.MarkerStyle.Width = new NLength(1.2f, NRelativeUnit.ParentPercentage); m_Line.MarkerStyle.Height = new NLength(1.2f, NRelativeUnit.ParentPercentage); m_Line.MarkerStyle.PointShape = PointShape.Cylinder; m_Line.MarkerStyle.FillStyle = new NColorFillStyle(Color.Gold); m_Line.BorderStyle.Color = Color.DarkGreen; m_Line.BorderStyle.Width = new NLength(2, NGraphicsUnit.Pixel); m_Line.Legend.Mode = SeriesLegendMode.None; m_Line.DataLabelStyle.Format = "<value>"; m_Line.Values.ValueFormatter = new NNumericValueFormatter("0.0"); m_Line.ShadowStyle.Type = ShadowType.GaussianBlur; m_Line.ShadowStyle.Offset = new NPointL(2, 2); m_Line.ShadowStyle.Color = Color.FromArgb(120, 0, 0, 0); m_Line.ShadowStyle.FadeLength = new NLength(5); // add the bar series m_Bar = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar); m_Bar.Name = "Bar1"; m_Bar.Values.Name = "values"; m_Bar.Values.ValueFormatter = new NNumericValueFormatter("0.0"); m_Bar.MultiBarMode = MultiBarMode.Stacked; m_Bar.DataLabelStyle.Visible = true; // 바에 보이는 값 //m_Bar.Legend.Mode = SeriesLegendMode.None; // 범례 안보이게 하는 거 m_Bar.BarShape = BarShape.Cylinder; m_Bar.BorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); m_Bar.FillStyle = new NColorFillStyle(Color.DarkKhaki); m_Bar.ShadowStyle.Type = ShadowType.Solid; m_Bar.ShadowStyle.Offset = new NPointL(2, 2); m_Bar.ShadowStyle.Color = Color.FromArgb(80, 0, 0, 0); //m_Bar.Values.FillRandomRange(new Random(), 14, 0, 100); NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); //m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale; m_Chart.Axis(StandardAxis.PrimaryX).ScrollBar.ResetButton.Visible = false; NNumericAxisPagingView numericPagingView = new NNumericAxisPagingView(new NRange1DD(0, 10)); m_Chart.Axis(StandardAxis.PrimaryX).PagingView = numericPagingView; m_Chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true; nChartControl1.Controller.Tools.Add(new NAxisScrollTool()); NStandardScaleConfigurator scaleConfiguratorX = (NStandardScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; scaleConfiguratorX.MajorTickMode = MajorTickMode.AutoMaxCount; scaleConfiguratorX.AutoLabels = false; foreach (ResultData.ResultInfo temp in rData.getRData()) { // 현재 찾고자 하는 프로젝트와 시나리오랑 같으면 if (temp.projectName == projectName && temp.taskName == ScenarioName) { if (idx == -1 /*&& temp.isMin == true*/) // ***************************************************************************************************************** check { ImgAverageInfo.Clear(); // 해당 시나리오 값에서 이동한 path 이미지들 값 가져오기 foreach (ResultData.ImgTime imgTemp in temp.pathInfo) { bool inList = false; float timeValue = System.Convert.ToSingle(imgTemp.timeImg); // 리스트 내에 같은 값 찾기 if (ImgAverageInfo.Count != 0) { foreach (ImgAverageTime inListImg in ImgAverageInfo) { // 같은게 있다면 if (inListImg.imgName == imgTemp.imgName) { inListImg.count += 1; inListImg.imgTime += timeValue; inList = true; break; } } } // 리스트 내에 없다면 if (inList == false) ImgAverageInfo.Add(new ImgAverageTime() { imgName = imgTemp.imgName, imgTime = timeValue, count = 1 }); } } // Idx랑 같으면 else if (temp.idx == idx) { // 해당 시나리오 값에서 이동한 path 이미지들 값 가져오기 foreach (ResultData.ImgTime imgTemp in temp.pathInfo) { scaleConfiguratorX.Labels.Add(imgTemp.imgName); m_Bar.Values.Add(imgTemp.timeImg); } } } } if (idx == -1) { foreach (ImgAverageTime listImg in ImgAverageInfo) { scaleConfiguratorX.Labels.Add(listImg.imgName); m_Bar.Values.Add(listImg.imgTime / listImg.count); } } //m_FuncCalculator.Arguments.Add(m_Line.Values); m_FuncCalculator.Arguments.Add(m_Bar.Values); m_FuncCalculator.Expression = "CUMSUM(values)"; m_Line.Values = m_FuncCalculator.Calculate(); m_Line.Values.ValueFormatter = new NNumericValueFormatter("0.0"); // form controls /*m_FunctionCombo.Items.Add("Power"); m_FunctionCombo.Items.Add("Cumulative"); m_FunctionCombo.Items.Add("Exponential Average"); m_FunctionCombo.SelectedIndex = 0;*/ nChartControl1.Refresh(); }