public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Axis Stripes"); 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 = nChartControl1.Charts[0]; m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = new NLinearScaleConfigurator(); // configure the x and y scales NLinearScaleConfigurator yScale = new NLinearScaleConfigurator(); // add interlaced stripe 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; yScale.StripStyles.Add(stripStyle); // display major grid lines at back and left walls yScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); yScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = yScale; NLinearScaleConfigurator xScale = new NLinearScaleConfigurator(); xScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); xScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = xScale; // Create a point series NPointSeries pnt = (NPointSeries)m_Chart.Series.Add(SeriesType.Point); pnt.InflateMargins = true; pnt.UseXValues = true; pnt.Name = "Series 1"; pnt.DataLabelStyle.Format = "<value>"; // Add some data pnt.Values.Add(3.1); pnt.Values.Add(6.7); pnt.Values.Add(1.2); pnt.Values.Add(8.4); pnt.Values.Add(9.0); pnt.XValues.Add(0.5); pnt.XValues.Add(1.8); pnt.XValues.Add(2.6); pnt.XValues.Add(3.1); pnt.XValues.Add(4.4); // Add stripes for the left and the bottom axes NAxisStripe s1 = m_Chart.Axis(StandardAxis.PrimaryY).Stripes.Add(2, 3); s1.FillStyle = new NColorFillStyle(Color.FromArgb(125, Color.SteelBlue)); NAxisStripe s2 = m_Chart.Axis(StandardAxis.PrimaryX).Stripes.Add(2, 3); s2.FillStyle = new NColorFillStyle(Color.FromArgb(125, Color.SteelBlue)); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // init form controls LeftBeginScroll.Value = (int)(s1.From * 10); LeftEndScroll.Value = (int)(s1.To * 10); BottomBeginScroll.Value = (int)(s2.From * 20); BottomEndScroll.Value = (int)(s2.To * 20); LeftTitleAlignmentCombo.FillFromEnum(typeof(ContentAlignment)); LeftTitleAlignmentCombo.SelectedItem = ContentAlignment.TopLeft.ToString(); BottomTitleAlignmentCombo.FillFromEnum(typeof(ContentAlignment)); BottomTitleAlignmentCombo.SelectedItem = ContentAlignment.TopLeft.ToString(); LeftTitleTextBox.Text = "Left Axis Const Line Title"; BottomTitleTextBox.Text = "Bottom Axis Const Line Title"; nChartControl1.Refresh(); }
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("Pie Slice Radius"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; title.ContentAlignment = ContentAlignment.BottomRight; title.Location = new NPointL( new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // setup legend NLegend legend = nChartControl1.Legends[0]; legend.FillStyle = new NColorFillStyle(Color.FromArgb(124, 255, 255, 255)); legend.HorizontalBorderStyle.Width = new NLength(0); legend.VerticalBorderStyle.Width = new NLength(0); legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Bottom); legend.Data.ExpandMode = LegendExpandMode.RowsFixed; legend.Data.RowCount = 2; legend.Data.CellMargins = new NMarginsL( new NLength(6, NGraphicsUnit.Pixel), new NLength(3, NGraphicsUnit.Pixel), new NLength(6, NGraphicsUnit.Pixel), new NLength(3, NGraphicsUnit.Pixel)); legend.Data.MarkSize = new NSizeL( new NLength(7, NGraphicsUnit.Pixel), new NLength(7, NGraphicsUnit.Pixel)); // by default the control contains a Cartesian chart -> remove it and create a Pie chart NPieChart pieChart = new NPieChart(); nChartControl1.Charts.Clear(); nChartControl1.Charts.Add(pieChart); pieChart.Enable3D = true; pieChart.InnerRadius = new NLength(0); pieChart.DisplayOnLegend = nChartControl1.Legends[0]; pieChart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveElevated); pieChart.BoundsMode = BoundsMode.Fit; pieChart.Location = new NPointL( new NLength(12, NRelativeUnit.ParentPercentage), new NLength(12, NRelativeUnit.ParentPercentage)); pieChart.Size = new NSizeL( new NLength(76, NRelativeUnit.ParentPercentage), new NLength(68, NRelativeUnit.ParentPercentage)); NPieSeries pieSeries = new NPieSeries(); pieChart.Series.Add(pieSeries); pieSeries.PieEdgePercent = 30; pieSeries.PieStyle = PieStyle.SmoothEdgePie; pieSeries.Legend.Mode = SeriesLegendMode.DataPoints; pieSeries.Legend.Format = "<label> <percent>"; pieSeries.UseBeginEndWidthPercents = true; for (int i = 0; i < 9; i++) { pieSeries.Values.Add(10 + i * 10); pieSeries.BeginWidthPercents.Add(0); pieSeries.EndWidthPercents.Add(10 + i * 10); } // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); }
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("Stack 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 interlaced stripe to the Y axis 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 floatbar series NFloatBarSeries floatbar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar); floatbar.MultiFloatBarMode = MultiFloatBarMode.Series; floatbar.Name = "Floatbar"; floatbar.FillStyle = new NColorFillStyle(Color.SandyBrown); floatbar.DataLabelStyle.Visible = false; // setup the bar series NBarSeries bar1 = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar1.Name = "Bar 1"; bar1.MultiBarMode = MultiBarMode.Stacked; bar1.FillStyle = new NColorFillStyle(Color.Green); bar1.DataLabelStyle.Visible = false; // setup the bar series NBarSeries bar2 = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar2.Name = "Bar 2"; bar2.MultiBarMode = MultiBarMode.Stacked; bar2.FillStyle = new NColorFillStyle(Color.CornflowerBlue); bar2.DataLabelStyle.Visible = false; if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(BarShapeDropDownList, typeof(BarShape)); BarShapeDropDownList.SelectedIndex = 0; DataTypeDropDownList.Items.Add("Positive Data"); DataTypeDropDownList.Items.Add("Positive and Negative Data"); DataTypeDropDownList.SelectedIndex = 0; } BarShape selectedShape = (BarShape)BarShapeDropDownList.SelectedIndex; floatbar.BarShape = selectedShape; bar1.BarShape = selectedShape; bar2.BarShape = selectedShape; if (DataTypeDropDownList.SelectedIndex == 0) { GeneratePosData(); } else { GeneratePosNegData(); } // 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) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; NHtmlImageMapResponse imageMapResponse = new NHtmlImageMapResponse(); nChartControl1.ServerSettings.BrowserResponseSettings.DefaultResponse = imageMapResponse; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("HTML Image Map"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // setup the chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); chart.Axis(StandardAxis.Depth).Visible = false; // add a bar series NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.DataLabelStyle.Visible = false; bar.Legend.Mode = SeriesLegendMode.DataPoints; bar.Legend.Format = "<label> <percent>"; bar.AddDataPoint(new NDataPoint(12, "Cars")); bar.AddDataPoint(new NDataPoint(42, "Trains")); bar.AddDataPoint(new NDataPoint(56, "Buses")); bar.AddDataPoint(new NDataPoint(23, "Ships")); // modify the axis labels NOrdinalScaleConfigurator ordinalScale = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; ordinalScale.AutoLabels = false; for (int i = 0; i < bar.Labels.Count; i++) { ordinalScale.Labels.Add((string)bar.Labels[i]); } // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.PaleMultiColor); styleSheet.Apply(chart); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); // add interactivity styles with the urls to redirect to and the corresponding cursors and tooltips NInteractivityStyle interactivityStyle = new NInteractivityStyle("Click here to jump to Cars sales page", CursorType.Hand); interactivityStyle.UrlLink.OpenInNewWindow = true; interactivityStyle.UrlLink.Url = "../Examples/GettingStarted/NCarSalesPage.aspx"; bar.InteractivityStyles[0] = interactivityStyle; interactivityStyle = new NInteractivityStyle("Click here to jump to Trains sales page", CursorType.Hand); interactivityStyle.UrlLink.OpenInNewWindow = true; interactivityStyle.UrlLink.Url = "../Examples/GettingStarted/NTrainSalesPage.aspx"; bar.InteractivityStyles[1] = interactivityStyle; interactivityStyle = new NInteractivityStyle("Click here to jump to Bus sales page", CursorType.Hand); interactivityStyle.UrlLink.OpenInNewWindow = true; interactivityStyle.UrlLink.Url = "../Examples/GettingStarted/NBusSalesPage.aspx"; bar.InteractivityStyles[2] = interactivityStyle; interactivityStyle = new NInteractivityStyle("Click here to jump to Ship sales page", CursorType.Hand); interactivityStyle.UrlLink.OpenInNewWindow = true; interactivityStyle.UrlLink.Url = "../Examples/GettingStarted/NShipSalesPage.aspx"; bar.InteractivityStyles[3] = interactivityStyle; }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Axis Gridlines"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); m_Chart = nChartControl1.Charts[0]; m_Chart.Enable3D = true; m_Chart.Height = 28; m_Chart.Depth = 40; m_Chart.BoundsMode = BoundsMode.Fit; m_Chart.Projection.Rotation = -19; m_Chart.Projection.Elevation = 20; m_Chart.Projection.Type = ProjectionType.Perspective; NStandardScaleConfigurator scaleConfigurator = m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NStandardScaleConfigurator; scaleConfigurator.AutoMinorTicks = false; scaleConfigurator.MinorTickCount = 3; NBarSeries bar = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar); bar.DataLabelStyle.Visible = false; bar.Values.FillRandomRange(Random, 5, 1, 20); bar.WidthPercent = 20; bar.DepthPercent = 20; bar.Name = "Series 1"; bar = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar); bar.DataLabelStyle.Visible = false; bar.Values.FillRandomRange(Random, 5, 1, 20); bar.WidthPercent = 20; bar.DepthPercent = 20; bar.Name = "Series 2"; bar = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar); bar.DataLabelStyle.Visible = false; bar.Values.FillRandomRange(Random, 5, 1, 20); bar.WidthPercent = 20; bar.DepthPercent = 20; bar.Name = "Series 3"; // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // init form controls LeftMajorCombo.SelectedIndex = 0; LeftMinorCombo.SelectedIndex = 0; BottomMajorCombo.SelectedIndex = 0; DepthMajorCombo.SelectedIndex = 0; NStandardScaleConfigurator leftScale = m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NStandardScaleConfigurator; leftScale.AutoMinorTicks = true; NStandardScaleConfigurator bottomScale = m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NStandardScaleConfigurator; NStandardScaleConfigurator depthScale = m_Chart.Axis(StandardAxis.Depth).ScaleConfigurator as NStandardScaleConfigurator; LeftMajor1Check.Checked = leftScale.MajorGridStyle.GetShowAtWall(ChartWallType.Left); LeftMajor2Check.Checked = leftScale.MajorGridStyle.GetShowAtWall(ChartWallType.Back); LeftMinor1Check.Checked = leftScale.MinorGridStyle.GetShowAtWall(ChartWallType.Left); LeftMinor2Check.Checked = leftScale.MinorGridStyle.GetShowAtWall(ChartWallType.Back); Bottom1Check.Checked = bottomScale.MajorGridStyle.GetShowAtWall(ChartWallType.Floor); Bottom2Check.Checked = bottomScale.MinorGridStyle.GetShowAtWall(ChartWallType.Back); Depth1Check.Checked = depthScale.MajorGridStyle.GetShowAtWall(ChartWallType.Floor); Depth2Check.Checked = depthScale.MinorGridStyle.GetShowAtWall(ChartWallType.Left); }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.Settings.JitterMode = JitterMode.Enabled; nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Horizontal Bar Chart"); 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 = nChartControl1.Charts[0]; nChart.Enable3D = true; nChart.Height = 70; nChart.Width = 55; nChart.SetPredefinedChartStyle(PredefinedChartStyle.HorizontalLeft); nChart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterRight); nChart.Axis(StandardAxis.Depth).Visible = false; // add interlace stripe to the Y axis NLinearScaleConfigurator linearScale = nChart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; 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 }; linearScale.StripStyles.Add(stripStyle); // add a bar series NBarSeries b1 = (NBarSeries)nChart.Series.Add(SeriesType.Bar); b1.MultiBarMode = MultiBarMode.Series; b1.Name = "Bar 1"; b1.DataLabelStyle.Format = "<value>"; b1.Values.AddRange(new double[] { 10, 27, 43, 71, 89, 93 }); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); // apply layout ApplyLayoutTemplate(0, nChartControl1, nChart, title, null); // init form controls if (IsPostBack) { NBarSeries bar = (NBarSeries)nChart.Series[0]; bar.BarShape = (BarShape)BarShapeDropDownList.SelectedIndex; if (PositiveDataCheckBox.Checked == true) { PositiveDataButton_Click(null, null); } else { PositiveAndNegativeDataButton_Click(null, null); } } else { WebExamplesUtilities.FillComboWithEnumValues(BarShapeDropDownList, typeof(BarShape)); BarShapeDropDownList.SelectedIndex = 0; } }
protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { LogarithmBaseTextBox.Text = "10"; LabelFormatDropDownList.Items.Add("Default"); LabelFormatDropDownList.Items.Add("Scientific"); LabelFormatDropDownList.SelectedIndex = 0; RoundToTickMin.Checked = true; RoundToTickMax.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel header = nChartControl1.Labels.AddHeader("Logarithmic 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)); // configure the chart m_Chart = nChartControl1.Charts[0]; m_Chart.BoundsMode = BoundsMode.Fit; m_Chart.Location = new NPointL( new NLength(5, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); m_Chart.Size = new NSizeL( new NLength(90, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage)); m_Chart.BoundsMode = BoundsMode.Stretch; m_Chart.Axis(StandardAxis.Depth).Visible = false; NLogarithmicScaleConfigurator logarithmicScale = new NLogarithmicScaleConfigurator(); logarithmicScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); logarithmicScale.MinorGridStyle.LineStyle.Pattern = LinePattern.Dot; logarithmicScale.MinorGridStyle.SetShowAtWall(ChartWallType.Back, true); logarithmicScale.MinorTickCount = 3; logarithmicScale.MajorTickMode = MajorTickMode.CustomStep; // 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; logarithmicScale.StripStyles.Add(stripStyle); logarithmicScale.CustomStep = 1; m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = logarithmicScale; 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.Cylinder; m_Line.MarkerStyle.Width = new NLength(0.7f, NRelativeUnit.ParentPercentage); m_Line.MarkerStyle.Height = new NLength(0.7f, NRelativeUnit.ParentPercentage); m_Line.MarkerStyle.AutoDepth = true; m_Line.DataLabelStyle.Format = "<value>"; m_Line.DataLabelStyle.ArrowStrokeStyle.Color = Color.CornflowerBlue; NStandardFrameStyle frameStyle = m_Line.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle; frameStyle.InnerBorderColor = Color.CornflowerBlue; m_Line.Values.Add(12); m_Line.Values.Add(100); m_Line.Values.Add(250); m_Line.Values.Add(500); m_Line.Values.Add(1500); m_Line.Values.Add(5500); m_Line.Values.Add(9090); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); UpdateScale(); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Polar 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)); // setup chart NPolarChart chart = new NPolarChart(); nChartControl1.Charts.Clear(); nChartControl1.Charts.Add(chart); chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); chart.DisplayOnLegend = nChartControl1.Legends[0]; chart.Width = 70.0f; chart.Height = 70.0f; chart.Depth = 5; // setup polar axis NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.Polar).ScaleConfigurator; linearScale.RoundToTickMax = true; linearScale.RoundToTickMin = true; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Polar, true); NScaleStripStyle strip = new NScaleStripStyle(); strip.FillStyle = new NColorFillStyle(Color.FromArgb(125, Color.Beige)); strip.Interlaced = true; strip.SetShowAtWall(ChartWallType.Polar, true); linearScale.StripStyles.Add(strip); // setup polar angle axis NAngularScaleConfigurator angularScale = (NAngularScaleConfigurator)chart.Axis(StandardAxis.PolarAngle).ScaleConfigurator; angularScale.MajorGridStyle.SetShowAtWall(ChartWallType.Polar, true); strip = new NScaleStripStyle(); strip.FillStyle = new NColorFillStyle(Color.FromArgb(125, 192, 192, 192)); strip.Interlaced = true; strip.SetShowAtWall(ChartWallType.Polar, true); angularScale.StripStyles.Add(strip); // polar area series 1 NPolarAreaSeries series1 = new NPolarAreaSeries(); chart.Series.Add(series1); series1.Name = "Theoretical"; series1.DataLabelStyle.Visible = false; GenerateData(series1, 100, 15.0); // polar area series 2 NPolarAreaSeries series2 = new NPolarAreaSeries(); chart.Series.Add(series2); series2.Name = "Experimental"; series2.DataLabelStyle.Visible = false; GenerateData(series2, 100, 10.0); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // init form controls AngleStepCombo.Items.Add("15"); AngleStepCombo.Items.Add("30"); AngleStepCombo.Items.Add("45"); AngleStepCombo.Items.Add("90"); AngleStepCombo.SelectedIndex = 0; }
public override void Initialize() { base.Initialize(); nChartControl1.Panels.Clear(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Legend General"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // create a simple pie chart NChart chart = new NPieChart(); chart.Enable3D = true; nChartControl1.Charts.Add(chart); chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalElevated); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.MetallicLustre); chart.BoundsMode = BoundsMode.None; chart.DisplayOnLegend = m_Legend; NPieSeries pie = (NPieSeries)chart.Series.Add(SeriesType.Pie); pie.LabelMode = PieLabelMode.Center; pie.Legend.Mode = SeriesLegendMode.DataPoints; pie.Legend.Format = "<label> <percent>"; pie.AddDataPoint(new NDataPoint(12, "Cars")); pie.AddDataPoint(new NDataPoint(42, "Trains")); pie.AddDataPoint(new NDataPoint(36, "Airplanes")); pie.AddDataPoint(new NDataPoint(23, "Buses")); pie.AddDataPoint(new NDataPoint(29, "Ships")); pie.AddDataPoint(new NDataPoint(15, "Other")); // create a legend m_Legend = new NLegend(); nChartControl1.Panels.Add(m_Legend); // tell the chart do display data on it chart.DisplayOnLegend = m_Legend; // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); // init form controls LegendModeComboBox.Items.Add("Disabled"); LegendModeComboBox.Items.Add("Automatic"); LegendModeComboBox.Items.Add("Manual"); PredefinedPositionsComboBox.Items.Add("Top"); PredefinedPositionsComboBox.Items.Add("Bottom"); PredefinedPositionsComboBox.Items.Add("Left"); PredefinedPositionsComboBox.Items.Add("Right"); PredefinedPositionsComboBox.Items.Add("Top right"); PredefinedPositionsComboBox.Items.Add("Top left"); ExpandModeComboBox.Items.Add("Rows only"); ExpandModeComboBox.Items.Add("Cols only"); ExpandModeComboBox.Items.Add("Rows fixed"); ExpandModeComboBox.Items.Add("Cols fixed"); if (m_Legend.Mode != LegendMode.Manual) { ManualMarksGroupBox.Enabled = false; } UpdateControlsFromLegend(); PredefinedPositionsComboBox.SelectedIndex = 4; }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("3D Floating Bars"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // no legend nChartControl1.Legends.Clear(); // configure the chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Width = 65; chart.Height = 40; chart.Axis(StandardAxis.Depth).Visible = false; chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.SoftTopLeft); // 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 < monthLetters.Length; i++) { scaleX.CustomLabels.Add(new NCustomValueLabel(i, monthLetters[i])); } // add interlaced stripe to the 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.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Left }; stripStyle.Interlaced = true; linearScale.StripStyles.Add(stripStyle); // create the float bar series NFloatBarSeries floatBar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar); floatBar.DataLabelStyle.Visible = false; floatBar.DataLabelStyle.VertAlign = VertAlign.Center; floatBar.DataLabelStyle.Format = "<begin> - <end>"; // add bars floatBar.AddDataPoint(new NFloatBarDataPoint(2, 10)); floatBar.AddDataPoint(new NFloatBarDataPoint(5, 16)); floatBar.AddDataPoint(new NFloatBarDataPoint(9, 17)); floatBar.AddDataPoint(new NFloatBarDataPoint(12, 21)); floatBar.AddDataPoint(new NFloatBarDataPoint(8, 18)); floatBar.AddDataPoint(new NFloatBarDataPoint(7, 18)); floatBar.AddDataPoint(new NFloatBarDataPoint(3, 11)); floatBar.AddDataPoint(new NFloatBarDataPoint(5, 12)); floatBar.AddDataPoint(new NFloatBarDataPoint(8, 17)); floatBar.AddDataPoint(new NFloatBarDataPoint(6, 15)); floatBar.AddDataPoint(new NFloatBarDataPoint(3, 10)); floatBar.AddDataPoint(new NFloatBarDataPoint(1, 7)); // apply layout ConfigureStandardLayout(chart, title, null); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // init form controls BarShapeCombo.FillFromEnum(typeof(BarShape)); BarShapeCombo.SelectedIndex = 0; }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { // set a chart title NLabel title = nChartControl1.Labels.AddHeader("XY Bubble Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); // setup chart m_Chart = nChartControl1.Charts[0]; NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; // add interlace style NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(new NArgbColor(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(); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); m_Bubble.DataLabelStyle.Visible = false; m_Bubble.Legend.Format = "<label>"; m_Bubble.Legend.Mode = SeriesLegendMode.DataPoints; m_Bubble.ShadowStyle.Type = ShadowType.Solid; m_Bubble.ShadowStyle.Offset = new NPointL(1.2f, 1.2f); m_Bubble.ShadowStyle.Color = Color.FromArgb(60, 0, 0, 0); m_Bubble.UseXValues = true; m_Bubble.AddDataPoint(new NBubbleDataPoint(27, 51, 1147995904, "India")); m_Bubble.AddDataPoint(new NBubbleDataPoint(50, 67, 1321851888, "China")); m_Bubble.AddDataPoint(new NBubbleDataPoint(76, 22, 109955400, "Mexico")); m_Bubble.AddDataPoint(new NBubbleDataPoint(210, 9, 142008838, "Russia")); m_Bubble.AddDataPoint(new NBubbleDataPoint(360, 4, 305843000, "USA")); m_Bubble.AddDataPoint(new NBubbleDataPoint(470, 5, 33560000, "Canada")); // apply layout ConfigureStandardLayout(m_Chart, title, nChartControl1.Legends[0]); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); // init form controls NExampleHelpers.FillComboWithEnumValues(BubbleShapeComboBox, typeof(PointShape)); BubbleShapeComboBox.SelectedIndex = 6; LegendFormatComboBox.Items.Add("Value and Label"); LegendFormatComboBox.Items.Add("Value"); LegendFormatComboBox.Items.Add("Label"); LegendFormatComboBox.Items.Add("Size"); LegendFormatComboBox.SelectedIndex = 2; InflateMarginsCheckBox.IsChecked = true; DifferentColorsCheckBox.IsChecked = true; MaxBubbleSizeScrollBar.Value = m_Bubble.MaxSize.Value / 100.0f; MinBubbleSizeScrollBar.Value = m_Bubble.MinSize.Value / 100.0f; InflateMarginsCheckBox_Checked(null, null); DifferentColorsCheckBox_Checked(null, null); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // init form controls WebExamplesUtilities.FillComboWithEnumValues(PieStyleDropDownList, typeof(PieStyle)); PieStyleDropDownList.SelectedIndex = (int)PieStyle.Ring; PieLabelModeDropDownList.Items.Add("Center"); PieLabelModeDropDownList.Items.Add("Rim"); PieLabelModeDropDownList.Items.Add("Spider"); PieLabelModeDropDownList.SelectedIndex = 1; WebExamplesUtilities.FillComboWithValues(ArrowLengthDropDownList, 0, 10, 1); ArrowLengthDropDownList.SelectedIndex = 4; WebExamplesUtilities.FillComboWithValues(ArrowPointerLengthDropDownList, 0, 10, 1); ArrowPointerLengthDropDownList.SelectedIndex = 4; WebExamplesUtilities.FillComboWithValues(DepthDropDownList, 0, 100, 10); DepthDropDownList.SelectedIndex = 1; WebExamplesUtilities.FillComboWithValues(BeginAngleDropDownList, 0, 360, 10); BeginAngleDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithValues(TotalAngleDropDownList, 0, 360, 10); TotalAngleDropDownList.SelectedIndex = 36; LightsCheckBox.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Pie Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; title.ContentAlignment = ContentAlignment.BottomRight; title.Location = new NPointL( new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // setup legend NLegend legend = nChartControl1.Legends[0]; legend.FillStyle = new NColorFillStyle(Color.FromArgb(124, 255, 255, 255)); legend.HorizontalBorderStyle.Width = new NLength(0); legend.VerticalBorderStyle.Width = new NLength(0); legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Bottom); legend.Data.ExpandMode = LegendExpandMode.RowsFixed; legend.Data.RowCount = 2; legend.Data.CellMargins = new NMarginsL( new NLength(6, NGraphicsUnit.Pixel), new NLength(3, NGraphicsUnit.Pixel), new NLength(6, NGraphicsUnit.Pixel), new NLength(3, NGraphicsUnit.Pixel)); legend.Data.MarkSize = new NSizeL( new NLength(7, NGraphicsUnit.Pixel), new NLength(7, NGraphicsUnit.Pixel)); // by default the control contains a Cartesian chart -> remove it and create a Pie chart NPieChart pieChart = new NPieChart(); nChartControl1.Charts.Clear(); nChartControl1.Charts.Add(pieChart); pieChart.Enable3D = true; pieChart.DisplayOnLegend = nChartControl1.Legends[0]; pieChart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveElevated); pieChart.Depth = DepthDropDownList.SelectedIndex * 10; pieChart.BoundsMode = BoundsMode.Fit; pieChart.Location = new NPointL( new NLength(12, NRelativeUnit.ParentPercentage), new NLength(12, NRelativeUnit.ParentPercentage)); pieChart.Size = new NSizeL( new NLength(76, NRelativeUnit.ParentPercentage), new NLength(68, NRelativeUnit.ParentPercentage)); pieChart.BeginAngle = BeginAngleDropDownList.SelectedIndex * 10; pieChart.TotalAngle = TotalAngleDropDownList.SelectedIndex * 10; pieChart.InnerRadius = new NLength(40); // setup pie series NPieSeries pie = (NPieSeries)pieChart.Series.Add(SeriesType.Pie); pie.Legend.Mode = SeriesLegendMode.DataPoints; pie.Legend.Format = "<label> <percent>"; pie.Legend.TextStyle.FontStyle.EmSize = new NLength(8, NGraphicsUnit.Point); pie.PieStyle = (PieStyle)PieStyleDropDownList.SelectedIndex; pie.LabelMode = (PieLabelMode)PieLabelModeDropDownList.SelectedIndex; pie.DataLabelStyle.ArrowLength = new NLength((float)ArrowLengthDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage); pie.DataLabelStyle.ArrowPointerLength = new NLength((float)ArrowPointerLengthDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage); pie.AddDataPoint(new NDataPoint(12, "Bikes")); pie.AddDataPoint(new NDataPoint(22, "Trains")); pie.AddDataPoint(new NDataPoint(19, "Cars")); pie.AddDataPoint(new NDataPoint(51, "Planes")); pie.AddDataPoint(new NDataPoint(23, "Buses", new NColorFillStyle(Color.Red))); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); switch (pie.LabelMode) { case PieLabelMode.Center: ArrowPointerLengthDropDownList.Enabled = false; ArrowLengthDropDownList.Enabled = false; break; case PieLabelMode.Rim: ArrowPointerLengthDropDownList.Enabled = true; ArrowLengthDropDownList.Enabled = true; break; case PieLabelMode.Spider: ArrowPointerLengthDropDownList.Enabled = true; ArrowLengthDropDownList.Enabled = true; break; } if (LightsCheckBox.Checked) { pieChart.LightModel.EnableLighting = true; pieChart.LightModel.SetPredefinedLightModel(PredefinedLightModel.BrightCameraLight); } else { pieChart.LightModel.EnableLighting = false; } }
public override void Initialize() { base.Initialize(); NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; nChartControl1.Controller.Selection.Add(chart); nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("XYZ Cluster 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; // 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); // add some data AddBarSeries(chart, MultiBarMode.Series); AddBarSeries(chart, MultiBarMode.Clustered); AddBarSeries(chart, MultiBarMode.Stacked); AddBarSeries(chart, MultiBarMode.Clustered); 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(); nChartControl1.Refresh(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(BubbleShapeDropDownList, typeof(PointShape)); BubbleShapeDropDownList.SelectedIndex = 6; WebExamplesUtilities.FillComboWithValues(MinBubbleSizeDropDownList, 0, 30, 5); WebExamplesUtilities.FillComboWithValues(MaxBubbleSizeDropDownList, 0, 30, 5); MinBubbleSizeDropDownList.SelectedIndex = 2; MaxBubbleSizeDropDownList.SelectedIndex = 4; DifferentColorsCheckBox.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Bubble Chart"); 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 = false; // setup X axis NOrdinalScaleConfigurator scaleX = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; scaleX.AutoLabels = false; scaleX.DisplayDataPointsBetweenTicks = false; scaleX.MajorTickMode = MajorTickMode.CustomTicks; scaleX.CustomMajorTicks.AddRange(new long[] { 0, 1, 2, 3, 4, 5 }); scaleX.CustomLabels.Add(new NCustomValueLabel(0, "A")); scaleX.CustomLabels.Add(new NCustomValueLabel(1, "B")); scaleX.CustomLabels.Add(new NCustomValueLabel(2, "C")); scaleX.CustomLabels.Add(new NCustomValueLabel(3, "D")); scaleX.CustomLabels.Add(new NCustomValueLabel(4, "E")); scaleX.CustomLabels.Add(new NCustomValueLabel(5, "F")); // 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.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); scaleY.StripStyles.Add(stripStyle); NBubbleSeries bubble = (NBubbleSeries)chart.Series.Add(SeriesType.Bubble); bubble.InflateMargins = true; bubble.DataLabelStyle.Visible = false; bubble.Legend.Mode = SeriesLegendMode.DataPoints; bubble.Legend.Format = "<size> <label>"; bubble.AddDataPoint(new NBubbleDataPoint(10, 10, "A")); bubble.AddDataPoint(new NBubbleDataPoint(15, 20, "B")); bubble.AddDataPoint(new NBubbleDataPoint(12, 25, "C")); bubble.AddDataPoint(new NBubbleDataPoint(8, 15, "D")); bubble.AddDataPoint(new NBubbleDataPoint(14, 17, "E")); bubble.AddDataPoint(new NBubbleDataPoint(11, 12, "F")); bubble.BubbleShape = (PointShape)BubbleShapeDropDownList.SelectedIndex; bubble.MinSize = new NLength(MinBubbleSizeDropDownList.SelectedIndex * 5, NRelativeUnit.ParentPercentage); bubble.MaxSize = new NLength(MaxBubbleSizeDropDownList.SelectedIndex * 5, NRelativeUnit.ParentPercentage); if (DifferentColorsCheckBox.Checked) { // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); } else { // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); } // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("2D Sampled Step Line Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // no legend nChartControl1.Legends.Clear(); // configure the chart m_Chart = nChartControl1.Charts[0]; // add interlaced stripe to the Y axis NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; ((NStandardScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator).StripStyles.Add(stripStyle); // add a line series m_Line = (NStepLineSeries)m_Chart.Series.Add(SeriesType.StepLine); m_Line.Name = "Line Series"; m_Line.InflateMargins = true; m_Line.DataLabelStyle.Visible = false; m_Line.MarkerStyle.Visible = false; m_Line.SamplingMode = SeriesSamplingMode.Enabled; m_Line.FilterType = SeriesFilterType.Distance; m_Line.MarkerStyle.PointShape = PointShape.Cylinder; m_Line.MarkerStyle.Width = new NLength(1.5f, NRelativeUnit.ParentPercentage); m_Line.MarkerStyle.Height = new NLength(1.5f, NRelativeUnit.ParentPercentage); m_Line.UseXValues = true; SampleDistanceScroll.Value = (int)m_Line.SampleDistance.Value; // apply layout ConfigureStandardLayout(m_Chart, title, null); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); GeneratorModeCombo.Items.Add("Generator 1 (Continous Y)"); GeneratorModeCombo.Items.Add("Generator 2 (Random Y)"); GeneratorModeCombo.SelectedIndex = 0; LineSegmentRouteComboBox.FillFromEnum(typeof(LineSegmentRoute)); LineSegmentRouteComboBox.SelectedIndex = (int)LineSegmentRoute.AlwaysHV; UseXValuesCheckBox.Checked = true; SampleDistanceScroll.Value = 10; NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0]; chart.RangeSelections.Add(new NRangeSelection()); chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true; chart.Axis(StandardAxis.PrimaryY).ScrollBar.Visible = true; nChartControl1.Controller.Selection.Add(chart); nChartControl1.Controller.Tools.Add(new NAxisScrollTool()); nChartControl1.Controller.Tools.Add(new NDataZoomTool()); Add40KDataButton_Click(null, null); }
public override void Initialize() { base.Initialize(); // confgigure chart nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Series Legend Assignment"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); header.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); header.DockMode = PanelDockMode.Top; header.Margins = new NMarginsL(0, 10, 0, 10); nChartControl1.Panels.Add(header); // configure the legends NLegend leftLegend = new NLegend(); leftLegend.DockMode = PanelDockMode.Left; leftLegend.Mode = LegendMode.Automatic; leftLegend.Data.ExpandMode = LegendExpandMode.ColsFixed; leftLegend.Data.ColCount = 2; leftLegend.BoundsMode = BoundsMode.Fit; leftLegend.Margins = new NMarginsL(10, 0, 0, 0); nChartControl1.Panels.Add(leftLegend); NLegend rightLegend = new NLegend(); rightLegend.DockMode = PanelDockMode.Right; rightLegend.Data.ExpandMode = LegendExpandMode.ColsFixed; rightLegend.Data.ColCount = 2; rightLegend.Mode = LegendMode.Automatic; rightLegend.BoundsMode = BoundsMode.Fit; rightLegend.Margins = new NMarginsL(0, 0, 10, 0); nChartControl1.Panels.Add(rightLegend); // create the chart m_Chart = new NCartesianChart(); m_Chart.Enable3D = true; m_Chart.DockMode = PanelDockMode.Fill; m_Chart.BoundsMode = BoundsMode.Fit; m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.MetallicLustre); m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); m_Chart.Margins = new NMarginsL(28, 10, 20, 10); nChartControl1.Panels.Add(m_Chart); m_Chart.Axis(StandardAxis.Depth).Visible = false; // 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; // position data labels in the center of the bars m_Bar1.DataLabelStyle.Visible = true; m_Bar1.DataLabelStyle.VertAlign = VertAlign.Center; m_Bar1.DataLabelStyle.Format = "<value>"; m_Bar2.DataLabelStyle.Visible = true; m_Bar2.DataLabelStyle.VertAlign = VertAlign.Center; m_Bar2.DataLabelStyle.Format = "<value>"; m_Bar3.DataLabelStyle.Visible = true; m_Bar3.DataLabelStyle.VertAlign = VertAlign.Center; m_Bar3.DataLabelStyle.Format = "<value>"; // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); m_bUpdateLegends = false; // first series legend configuration FirstDisplayOnLegendComboBox.Items.Add("Left"); FirstDisplayOnLegendComboBox.Items.Add("Right"); FirstDisplayOnLegendComboBox.SelectedIndex = 0; FirstSeriesLegendModeComboBox.Items.Add("None"); FirstSeriesLegendModeComboBox.Items.Add("Series"); FirstSeriesLegendModeComboBox.Items.Add("DataPoints"); FirstSeriesLegendModeComboBox.Items.Add("SeriesLogic"); FirstSeriesLegendModeComboBox.SelectedIndex = 2; FirstSeriesFormatTextBox.Text = m_Bar1.Legend.Format; // second series legend configuration SecondDisplayOnLegendComboBox.Items.Add("Left"); SecondDisplayOnLegendComboBox.Items.Add("Right"); SecondDisplayOnLegendComboBox.SelectedIndex = 0; SecondSeriesLegendModeComboBox.Items.Add("None"); SecondSeriesLegendModeComboBox.Items.Add("Series"); SecondSeriesLegendModeComboBox.Items.Add("DataPoints"); SecondSeriesLegendModeComboBox.Items.Add("SeriesLogic"); SecondSeriesLegendModeComboBox.SelectedIndex = 2; SecondSeriesFormatTextBox.Text = m_Bar2.Legend.Format; // third series legend configuration ThirdDisplayOnLegendComboBox.Items.Add("Left"); ThirdDisplayOnLegendComboBox.Items.Add("Right"); ThirdDisplayOnLegendComboBox.SelectedIndex = 1; ThirdSeriesLegendModeComboBox.Items.Add("None"); ThirdSeriesLegendModeComboBox.Items.Add("Series"); ThirdSeriesLegendModeComboBox.Items.Add("DataPoints"); ThirdSeriesLegendModeComboBox.Items.Add("SeriesLogic"); ThirdSeriesLegendModeComboBox.SelectedIndex = 2; ThirdSeriesFormatTextBox.Text = m_Bar2.Legend.Format; m_bUpdateLegends = true; PositiveDataButton_Click(null, null); ConfigureLegends(); }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { // set a chart title NLabel title = new NLabel("DateTime Float Bar"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); // setup chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; // setup Y axis NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); // add interlaced stripe 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); chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale; // setup x axis NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); dateTimeScale.LabelValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.Date); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale; // create the float bar series NFloatBarSeries floatBar = new NFloatBarSeries(); chart.Series.Add(floatBar); floatBar.UseXValues = true; floatBar.UseZValues = false; floatBar.InflateMargins = true; floatBar.DataLabelStyle.Visible = false; // bar appearance floatBar.BorderStyle.Color = Color.Bisque; floatBar.ShadowStyle.Type = ShadowType.Solid; floatBar.ShadowStyle.Color = Color.FromArgb(30, 0, 0, 0); floatBar.Values.ValueFormatter = new NNumericValueFormatter("0.00"); floatBar.EndValues.ValueFormatter = new NNumericValueFormatter("0.00"); // show the begin end values in the legend floatBar.Legend.Format = "<begin> - <end>"; floatBar.Legend.Mode = SeriesLegendMode.DataPoints; GenerateData(floatBar); // apply layout ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); }
public override void Initialize() { base.Initialize(); NChart chart = nChartControl1.Charts[0]; nChartControl1.Controller.Selection.Add(chart); nChartControl1.Controller.Tools.Add(new NTrackballTool()); // set a chart title NLabel title = new NLabel("XYZ Smooth Line"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // no legend nChartControl1.Legends.Clear(); // configure the chart chart.Enable3D = true; chart.Depth = 55.0f; chart.Width = 55.0f; chart.Height = 55.0f; chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); // setup axes NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale = new NLinearScaleConfigurator(); chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; // add 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); linearScale.StripStyles.Add(stripStyle); linearScale = new NLinearScaleConfigurator(); chart.Axis(StandardAxis.Depth).Visible = true; chart.Axis(StandardAxis.Depth).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; // add the smooth line NSmoothLineSeries line = (NSmoothLineSeries)chart.Series.Add(SeriesType.SmoothLine); line.Name = "Smooth Line"; line.InflateMargins = true; line.Legend.Mode = SeriesLegendMode.Series; line.BorderStyle.Color = Color.Indigo; line.BorderStyle.Width = new NLength(1, NGraphicsUnit.Pixel); 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(); // apply layout ConfigureStandardLayout(chart, title, null); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); checkShowMarkers.Checked = true; checkRoundToTick.Checked = true; }
public override void Initialize() { base.Initialize(); nChartControl1.Panels.Clear(); // set a chart title NLabel title = new NLabel("Montana County Comparison<br/><font size = '9pt'>Demonstrates how to create a multi measure radar chart</font>"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.TextFormat = TextFormat.XML; title.ContentAlignment = ContentAlignment.BottomRight; title.Location = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); title.DockMode = PanelDockMode.Top; title.Margins = new NMarginsL(0, 5, 0, 5); nChartControl1.Panels.Add(title); NLegend legend = new NLegend(); legend.DockMode = PanelDockMode.Right; legend.Margins = new NMarginsL(5, 0, 5, 0); nChartControl1.Panels.Add(legend); // setup chart NRadarChart radarChart = new NRadarChart(); radarChart.Margins = new NMarginsL(5, 0, 0, 5); nChartControl1.Panels.Add(radarChart); radarChart.DisplayOnLegend = legend; radarChart.DockMode = PanelDockMode.Fill; radarChart.RadarMode = RadarMode.MultiMeasure; radarChart.InnerRadius = new NLength(10, NRelativeUnit.ParentPercentage); // set some axis labels AddAxis(radarChart, "Population", true); AddAxis(radarChart, "Housing Units", true); AddAxis(radarChart, "Water", false); AddAxis(radarChart, "Land", true); AddAxis(radarChart, "Population\r\nDensity", false); AddAxis(radarChart, "Housing\r\nDensity", false); // sample data object[] data = new object[] { "Cascade County", 80357, 35225, 13.75, 2697.90, 29.8, 13.1, "Custer County", 11696, 5360, 10.09, 3783.13, 3.1, 1.4, "Dawson County", 9059, 4168, 9.99, 2373.14, 3.8, 1.8, "Jefferson County", 10049, 4199, 2.19, 1656.64, 6.1, 2.5, "Missoula County", 95802, 41319, 20.37, 2597.97, 36.9, 15.9, "Powell County", 7180, 2930, 6.74, 2325.94, 3.1, 1.3 }; for (int i = 0; i < 6; i++) { NRadarLineSeries radarLine = new NRadarLineSeries(); radarChart.Series.Add(radarLine); int baseIndex = i * 7; radarLine.Name = data[baseIndex].ToString(); baseIndex = baseIndex + 1; for (int j = 0; j < 6; j++) { radarLine.Values.Add(System.Convert.ToDouble(data[baseIndex])); baseIndex = baseIndex + 1; } radarLine.DataLabelStyle.Visible = false; radarLine.MarkerStyle.Width = new NLength(4); radarLine.MarkerStyle.Height = new NLength(4); radarLine.MarkerStyle.Visible = true; radarLine.BorderStyle.Width = new NLength(2); } // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(ShapeDropDownList, typeof(BarShape)); ShapeDropDownList.SelectedIndex = 0; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; // set a chart title NLabel title = new NLabel("3D Range Series"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); // setup chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); 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(); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale; chart.Axis(StandardAxis.PrimaryX).View = new NRangeAxisView(new NRange1DD(0, 20), true, true); // setup Y axis linearScale = new NLinearScaleConfigurator(); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale; chart.Axis(StandardAxis.PrimaryY).View = new NRangeAxisView(new NRange1DD(0, 20), true, true); // add interlaced stripe 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); // setup Depth axis linearScale = new NLinearScaleConfigurator(); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.Depth).ScaleConfigurator = linearScale; chart.Axis(StandardAxis.Depth).View = new NRangeAxisView(new NRange1DD(0, 20), true, true); // setup shape series NRangeSeries rangeSeries = (NRangeSeries)chart.Series.Add(SeriesType.Range); rangeSeries.FillStyle = new NColorFillStyle(Color.Red); rangeSeries.BorderStyle.Color = Color.DarkRed; rangeSeries.Legend.Mode = SeriesLegendMode.None; rangeSeries.DataLabelStyle.Visible = false; rangeSeries.UseXValues = true; rangeSeries.UseZValues = true; rangeSeries.Shape = (BarShape)ShapeDropDownList.SelectedIndex; // add data AddDataPoint(rangeSeries, 1, 5, 11, 17, 5, 9); AddDataPoint(rangeSeries, 4, 7, 15, 19, 16, 19); AddDataPoint(rangeSeries, 5, 15, 6, 11, 12, 18); AddDataPoint(rangeSeries, 9, 14, 2, 5, 3, 5); AddDataPoint(rangeSeries, 15, 19, 2, 5, 3, 5); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Float Bar Palette"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // no legend nChartControl1.Legends.Clear(); // configure the chart m_Chart = nChartControl1.Charts[0]; m_Chart.Axis(StandardAxis.Depth).Visible = false; // setup X axis NOrdinalScaleConfigurator scaleX = m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator; scaleX.AutoLabels = false; scaleX.MajorTickMode = MajorTickMode.AutoMaxCount; scaleX.DisplayDataPointsBetweenTicks = false; for (int i = 0; i < monthLetters.Length; i++) { scaleX.CustomLabels.Add(new NCustomValueLabel(i, monthLetters[i])); } // add interlaced stripe to the Y axis NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; 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; linearScale.StripStyles.Add(stripStyle); // create the float bar series m_FloatBar = (NFloatBarSeries)m_Chart.Series.Add(SeriesType.FloatBar); m_FloatBar.DataLabelStyle.Visible = false; m_FloatBar.DataLabelStyle.VertAlign = VertAlign.Center; m_FloatBar.DataLabelStyle.Format = "<begin> - <end>"; // add bars m_FloatBar.AddDataPoint(new NFloatBarDataPoint(2, 10)); m_FloatBar.AddDataPoint(new NFloatBarDataPoint(5, 16)); m_FloatBar.AddDataPoint(new NFloatBarDataPoint(9, 17)); m_FloatBar.AddDataPoint(new NFloatBarDataPoint(12, 21)); m_FloatBar.AddDataPoint(new NFloatBarDataPoint(8, 18)); m_FloatBar.AddDataPoint(new NFloatBarDataPoint(7, 18)); m_FloatBar.AddDataPoint(new NFloatBarDataPoint(3, 11)); m_FloatBar.AddDataPoint(new NFloatBarDataPoint(5, 12)); m_FloatBar.AddDataPoint(new NFloatBarDataPoint(8, 17)); m_FloatBar.AddDataPoint(new NFloatBarDataPoint(6, 15)); m_FloatBar.AddDataPoint(new NFloatBarDataPoint(3, 10)); m_FloatBar.AddDataPoint(new NFloatBarDataPoint(1, 7)); NPalette palette = new NPalette(); palette.Clear(); palette.Mode = PaletteMode.Custom; palette.Add(0, Color.Green); palette.Add(10, Color.Yellow); palette.Add(20, Color.Red); m_FloatBar.Palette = palette; // apply layout ConfigureStandardLayout(m_Chart, title, null); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); SmoothPaletteCheckBox.Checked = true; Enable3DCheckBox.Checked = true; }
public override void Initialize() { base.Initialize(); Nevron.UI.WinForm.Controls.NPalette palette = Nevron.UI.WinForm.Controls.NUIManager.Palette; // Clear the chart panels nChartControl1.Panels.Clear(); // Create a background style to assign to the new panels NBackgroundStyle backroundStyle = new NBackgroundStyle(); backroundStyle.FillStyle = new NColorFillStyle(Color.Transparent); NImageFrameStyle frameStyle = new NImageFrameStyle(); frameStyle.BorderStyle.Color = palette.ControlDark; frameStyle.BackgroundColor = Color.Transparent; frameStyle.Type = ImageFrameType.Raised; backroundStyle.FrameStyle = frameStyle; // Create the label background panel m_LabelBackgroundPanel = new NBackgroundDecoratorPanel(); m_LabelBackgroundPanel.Size = new NSizeL(new NLength(0, NGraphicsUnit.Pixel), new NLength(10, NRelativeUnit.ParentPercentage)); m_LabelBackgroundPanel.DockMode = PanelDockMode.Top; m_LabelBackgroundPanel.DockMargins = new NMarginsL(new NLength(5, NGraphicsUnit.Point), new NLength(5, NGraphicsUnit.Point), new NLength(5, NGraphicsUnit.Point), new NLength(5, NGraphicsUnit.Point)); m_LabelBackgroundPanel.BackgroundStyle = (NBackgroundStyle)backroundStyle.Clone(); nChartControl1.Panels.Add(m_LabelBackgroundPanel); // Create the legend background panel m_LegendBackgroundPanel = new NBackgroundDecoratorPanel(); m_LegendBackgroundPanel.Size = new NSizeL(new NLength(20, NRelativeUnit.ParentPercentage), new NLength(0, NGraphicsUnit.Pixel)); m_LegendBackgroundPanel.DockMode = PanelDockMode.Right; m_LegendBackgroundPanel.BackgroundStyle = (NBackgroundStyle)backroundStyle.Clone(); m_LegendBackgroundPanel.DockMargins = new NMarginsL(new NLength(5, NGraphicsUnit.Point), new NLength(5, NGraphicsUnit.Point), new NLength(5, NGraphicsUnit.Point), new NLength(5, NGraphicsUnit.Point)); nChartControl1.Panels.Add(m_LegendBackgroundPanel); // Create the chart background panel NBackgroundDecoratorPanel chartBackgroundPanel = new NBackgroundDecoratorPanel(); chartBackgroundPanel.BackgroundStyle = (NBackgroundStyle)backroundStyle.Clone(); chartBackgroundPanel.DockMode = PanelDockMode.Fill; chartBackgroundPanel.DockMargins = new NMarginsL(new NLength(5, NGraphicsUnit.Point), new NLength(5, NGraphicsUnit.Point), new NLength(5, NGraphicsUnit.Point), new NLength(5, NGraphicsUnit.Point)); nChartControl1.Panels.Add(chartBackgroundPanel); // Create the header label and host it in the label background panel NLabel title = new NLabel("Background Decorator Panel"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(Color.SlateGray); title.ContentAlignment = ContentAlignment.MiddleCenter; title.DockMode = PanelDockMode.Fill; title.BoundsMode = BoundsMode.Fit; title.Location = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); title.DockMargins = new NMarginsL(frameStyle.LightEffectSize, frameStyle.LightEffectSize, frameStyle.LightEffectSize, frameStyle.LightEffectSize); m_LabelBackgroundPanel.ChildPanels.Add(title); // Create the legend and host it in the legend background panel NLegend legend = new NLegend(); legend.DockMode = PanelDockMode.Fill; legend.ContentAlignment = ContentAlignment.MiddleCenter; legend.DockMargins = new NMarginsL(frameStyle.LightEffectSize, frameStyle.LightEffectSize, frameStyle.LightEffectSize, frameStyle.LightEffectSize); m_LegendBackgroundPanel.ChildPanels.Add(legend); // Create a cartesian chart and host it in the chart background panel NChart chart = new NCartesianChart(); chartBackgroundPanel.ChildPanels.Add(chart); chart.DisplayOnLegend = legend; chart.BoundsMode = BoundsMode.Stretch; // add bar and change bar color NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.Name = "Bar Series"; bar.Legend.Mode = SeriesLegendMode.DataPoints; bar.ShadowStyle.Type = ShadowType.GaussianBlur; bar.ShadowStyle.Offset = new NPointL(3, 3); bar.ShadowStyle.Color = Color.FromArgb(80, 0, 0, 0); bar.ShadowStyle.FadeLength = new NLength(5); // add some data to the bar series bar.AddDataPoint(new NDataPoint(18, "C++")); bar.AddDataPoint(new NDataPoint(15, "Ruby")); bar.AddDataPoint(new NDataPoint(21, "Python")); bar.AddDataPoint(new NDataPoint(23, "Java")); bar.AddDataPoint(new NDataPoint(27, "Javascript")); bar.AddDataPoint(new NDataPoint(29, "C#")); bar.AddDataPoint(new NDataPoint(26, "PHP")); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); // init form controls DockTitleComboBox.Items.Add("Top"); DockTitleComboBox.Items.Add("Bottom"); DockTitleComboBox.SelectedIndex = 0; DockLegendComboBox.Items.Add("Left"); DockLegendComboBox.Items.Add("Right"); DockLegendComboBox.SelectedIndex = 1; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // init form controls WebExamplesUtilities.FillComboWithEnumValues(ClusterModeDropDownList, typeof(ClusterMode)); ClusterModeDropDownList.SelectedIndex = (int)ClusterMode.Enabled; for (int i = 0; i < 9; i++) { ClusterDistanceFactorDropDownList.Items.Add("0.0" + (i + 1).ToString()); } WebExamplesUtilities.FillComboWithValues(NumberOfPointGroupsDropDownList, 1, 10, 1); NumberOfPointGroupsDropDownList.SelectedIndex = 2; WebExamplesUtilities.FillComboWithValues(NumberOfPointsInGroupDropDownList, 5000, 15000, 5000); NumberOfPointsInGroupDropDownList.SelectedIndex = 0; } // switch to OpenGL rendering nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("XYZ Scatter Point Cluster Chart"); 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.Width = 50; chart.Depth = 50; chart.Height = 50; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); // setup Y axis NLinearScaleConfigurator linearScaleConfigurator = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; 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 linearScaleConfigurator = new NLinearScaleConfigurator(); linearScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScaleConfigurator.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 8); 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.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 8); linearScaleConfigurator.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Left, ChartWallType.Floor }; chart.Axis(StandardAxis.Depth).ScaleConfigurator = linearScaleConfigurator; // setup point series NPointSeries point = (NPointSeries)chart.Series.Add(SeriesType.Point); point.Name = "Point1"; point.DataLabelStyle.Visible = false; point.MarkerStyle.Visible = false; point.Legend.Mode = SeriesLegendMode.None; point.PointShape = PointShape.Bar; point.BorderStyle.Width = new NLength(0); point.Size = new NLength(1); point.UseXValues = true; point.UseZValues = true; // update cluster settings point.ClusterMode = (ClusterMode)ClusterModeDropDownList.SelectedIndex; point.ClusterDistanceFactor = (ClusterDistanceFactorDropDownList.SelectedIndex + 1) * 0.01; // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // init the chart with some random values GenerateXYZData(point); NumberOfDataPointsLabel.Text = "Number of Data Points:" + (point.Values.Count / 1000).ToString() + "K"; // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Stacked Radar Area"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // configure the chart m_Chart = new NRadarChart(); nChartControl1.Charts.Clear(); nChartControl1.Charts.Add(m_Chart); m_Chart.Wall(ChartWallType.Radar).BorderStyle.Color = Color.White; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); m_Chart.DisplayOnLegend = nChartControl1.Legends[0]; AddAxis("Category A"); AddAxis("Category B"); AddAxis("Category C"); AddAxis("Category D"); AddAxis("Category E"); // create the radar series NRadarAreaSeries radarArea0 = new NRadarAreaSeries(); m_Chart.Series.Add(radarArea0); radarArea0.Name = "Series 1"; radarArea0.Values.FillRandomRange(Random, 5, 50, 90); radarArea0.DataLabelStyle.Visible = false; radarArea0.DataLabelStyle.Format = "<value>"; radarArea0.MarkerStyle.AutoDepth = true; radarArea0.MarkerStyle.Width = new NLength(1.5f, NRelativeUnit.ParentPercentage); radarArea0.MarkerStyle.Height = new NLength(1.5f, NRelativeUnit.ParentPercentage); NRadarAreaSeries radarArea1 = new NRadarAreaSeries(); m_Chart.Series.Add(radarArea1); radarArea1.Name = "Series 2"; radarArea1.Values.FillRandomRange(Random, 5, 0, 100); radarArea1.DataLabelStyle.Visible = false; radarArea1.DataLabelStyle.Format = "<value>"; radarArea1.MarkerStyle.AutoDepth = true; radarArea1.MarkerStyle.Width = new NLength(1.5f, NRelativeUnit.ParentPercentage); radarArea1.MarkerStyle.Height = new NLength(1.5f, NRelativeUnit.ParentPercentage); // stack the second radar area series radarArea1.MultiAreaMode = MultiAreaMode.Stacked; NRadarAreaSeries radarArea2 = new NRadarAreaSeries(); m_Chart.Series.Add(radarArea2); radarArea2.Name = "Series 3"; radarArea2.Values.FillRandomRange(Random, 5, 0, 100); radarArea2.DataLabelStyle.Visible = false; radarArea2.DataLabelStyle.Format = "<value>"; radarArea2.MarkerStyle.AutoDepth = true; radarArea2.MarkerStyle.Width = new NLength(1.5f, NRelativeUnit.ParentPercentage); radarArea2.MarkerStyle.Height = new NLength(1.5f, NRelativeUnit.ParentPercentage); // stack the third radar area series radarArea2.MultiAreaMode = MultiAreaMode.Stacked; // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Charts[0].Series); radarArea0.FillStyle.SetTransparencyPercent(20); radarArea1.FillStyle.SetTransparencyPercent(20); radarArea2.FillStyle.SetTransparencyPercent(20); // apply layout ConfigureStandardLayout(m_Chart, title, nChartControl1.Legends[0]); // init form controls BeginAngleUpDown.Value = 90; TitleAngleModeComboBox.FillFromEnum(typeof(ScaleLabelAngleMode)); TitleAngleModeComboBox.SelectedIndex = (int)ScaleLabelAngleMode.Scale; StackModeCombo.Items.Add("Stacked"); StackModeCombo.Items.Add("Stacked %"); StackModeCombo.SelectedIndex = 0; }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Date / Time Axis Paging"); 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 = nChartControl1.Charts[0]; m_Chart.BoundsMode = BoundsMode.Stretch; // configure the X and Y axes to use linear scale without tick rounding NValueTimelineScaleConfigurator timelineScale = new NValueTimelineScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = timelineScale; timelineScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); m_Chart.Axis(StandardAxis.PrimaryX).ScrollBar.ResetButton.Visible = false; m_Chart.Axis(StandardAxis.PrimaryX).ScrollBar.ShowSliders = false; // add interlace stripe to the X axis NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(40, Color.LightGray)), null, true, 0, 0, 1, 1); stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); timelineScale.StripStyles.Add(stripStyle); NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.RoundToTickMax = false; linearScale.RoundToTickMin = false; // add interlace stripe to the Y axis stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(40, Color.LightGray)), null, true, 0, 0, 1, 1); stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.StripStyles.Add(stripStyle); // configure a XY scatter point chart NPointSeries point = (NPointSeries)m_Chart.Series.Add(SeriesType.Point); point.UseXValues = true; point.Size = new NLength(5, NGraphicsUnit.Point); point.DataLabelStyle.Visible = false; point.Values.FillRandomRange(Random, 100, 0, 100); DateTime now = DateTime.Now; // add data for ten thousand days from now for (int i = 0; i < 1000; i++) { point.XValues.Add(now + new TimeSpan(i * 10, 0, 0, 0, 0)); } // configure the x and y axis paging NDateTimeAxisPagingView dateTimePagingView = new NDateTimeAxisPagingView(now, new NDateTimeSpan(1, NDateTimeUnit.Month)); dateTimePagingView.Enabled = true; m_Chart.Axis(StandardAxis.PrimaryX).PagingView = dateTimePagingView; // subscribe for the scrollbar value changed event m_Chart.Axis(StandardAxis.PrimaryX).ScrollBar.BeginValueChanged += new EventHandler(ScrollbarValueChanged); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); m_Updating = true; StartDateTimePicker.Value = now; BottomAxisPageSizeNumericUpDown.Value = 2; ShowScrollbarCheckBox.Checked = true; AutoSmallChangeCheckBox.Checked = true; m_Updating = false; nChartControl1.Controller.Tools.Add(new NAxisScrollTool()); nChartControl1.Refresh(); UpdateAxis(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // init form controls WebExamplesUtilities.FillComboWithEnumValues(AnimationThemeTypeCombo, typeof(AnimationThemeType)); AnimationThemeTypeCombo.SelectedIndex = (int)AnimationThemeType.ScaleAndFade; WebExamplesUtilities.FillComboWithValues(AxesAnimationDurationCombo, 1, 10, 1); AxesAnimationDurationCombo.SelectedIndex = 2; WebExamplesUtilities.FillComboWithValues(IndicatorsAnimationDurationCombo, 1, 10, 1); IndicatorsAnimationDurationCombo.SelectedIndex = 2; } nChartControl1.Panels.Clear(); nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel header = nChartControl1.Labels.AddHeader("Animation Themes"); 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.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL(new NLength(3, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // create the radial gauge CreateRadialGauge(); // create the linear gauge CreateLinearGauge(); m_RadialGauge.Location = new NPointL(new NLength(0, NRelativeUnit.ParentPercentage), new NLength(20, NRelativeUnit.ParentPercentage)); m_RadialGauge.Size = new NSizeL(new NLength(60, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage)); m_RadialGauge.ContentAlignment = ContentAlignment.BottomRight; m_LinearGauge.Location = new NPointL(new NLength(70, NRelativeUnit.ParentPercentage), new NLength(20, NRelativeUnit.ParentPercentage)); m_LinearGauge.Size = new NSizeL(new NLength(80, NGraphicsUnit.Point), new NLength(80, NRelativeUnit.ParentPercentage)); m_LinearGauge.Padding = new NMarginsL(0, 13, 0, 13); m_LinearGauge.Orientation = LinearGaugeOrientation.Vertical; // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // apply animation theme NAnimationTheme animationTheme = new NAnimationTheme(); animationTheme.AxesAnimationDuration = (float)(AxesAnimationDurationCombo.SelectedIndex + 1); animationTheme.IndicatorsAnimationDuration = (float)(IndicatorsAnimationDurationCombo.SelectedIndex + 1); animationTheme.AnimatePanelsSequentially = SequentialPanels.Checked; animationTheme.AnimateGaugesSequentially = SequentialGauges.Checked; animationTheme.AnimateIndicatorsSequentially = SequentialIndicators.Checked; animationTheme.AnimationThemeType = (AnimationThemeType)AnimationThemeTypeCombo.SelectedIndex; animationTheme.Apply(nChartControl1.Document); NImageResponse swfResponse = new NImageResponse(); swfResponse.ImageFormat = new NSwfImageFormat(); nChartControl1.ImageAcquisitionMode = ClientSideImageAcquisitionMode.TempFile; nChartControl1.ServerSettings.BrowserResponseSettings.DefaultResponse = swfResponse; }
public override void Initialize() { base.Initialize(); nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); // set a chart title NLabel title = new NLabel("XYZ Bubble Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // setup chart m_Chart = nChartControl1.Charts[0]; m_Chart.Enable3D = true; m_Chart.Width = 50; m_Chart.Depth = 50; m_Chart.Height = 50; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); NLinearScaleConfigurator depthScale = new NLinearScaleConfigurator(); depthScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; depthScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); depthScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); m_Chart.Axis(StandardAxis.Depth).ScaleConfigurator = depthScale; NLinearScaleConfigurator yScale = new NLinearScaleConfigurator(); yScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; yScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); yScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); // add interlace style NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(new NArgbColor(Color.Beige)), null, true, 0, 0, 1, 1); stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); stripStyle.Interlaced = true; yScale.StripStyles.Add(stripStyle); m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = yScale; // switch the x axis in linear mode NLinearScaleConfigurator xScale = new NLinearScaleConfigurator(); xScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; xScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); xScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = xScale; m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); m_Bubble.InflateMargins = true; m_Bubble.DataLabelStyle.Visible = false; m_Bubble.BubbleShape = PointShape.Sphere; m_Bubble.Legend.Format = "x:<xvalue> y:<value> z:<zvalue> sz:<size>"; m_Bubble.Legend.Mode = SeriesLegendMode.DataPoints; m_Bubble.MinSize = new NLength(10.0f, NRelativeUnit.ParentPercentage); m_Bubble.MaxSize = new NLength(20.0f, NRelativeUnit.ParentPercentage); m_Bubble.UseXValues = true; m_Bubble.UseZValues = true; m_Bubble.Values.ValueFormatter = new NNumericValueFormatter("0.#"); m_Bubble.XValues.ValueFormatter = new NNumericValueFormatter("0.#"); m_Bubble.ZValues.ValueFormatter = new NNumericValueFormatter("0.#"); m_Bubble.Sizes.ValueFormatter = new NNumericValueFormatter("0.#"); GenerateData(); // apply layout ConfigureStandardLayout(m_Chart, title, nChartControl1.Legends[0]); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); }
protected void Page_Load(object sender, System.EventArgs e) { if (nChartControl1.RequiresInitialization) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel header = nChartControl1.Labels.AddHeader("Mouse Events"); header.TextStyle.FontStyle = new NFontStyle("Palatino Linotype", 14, FontStyle.Italic); header.TextStyle.FillStyle = new NColorFillStyle(Color.FromArgb(60, 90, 108)); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // clear the legends nChartControl1.Legends.Clear(); // configure stack bar chart NChart chart1 = nChartControl1.Charts[0]; chart1.Tag = "BarChart"; chart1.Location = new NPointL(new NLength(5, NRelativeUnit.ParentPercentage), new NLength(10, NRelativeUnit.ParentPercentage)); chart1.Size = new NSizeL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage)); chart1.BoundsMode = BoundsMode.Fit; chart1.Axis(StandardAxis.Depth).Visible = false; // add the first bar NBarSeries bar1 = (NBarSeries)chart1.Series.Add(SeriesType.Bar); bar1.Name = "Cars"; bar1.MultiBarMode = MultiBarMode.Series; bar1.DataLabelStyle.Visible = false; // add the second bar NBarSeries bar2 = (NBarSeries)chart1.Series.Add(SeriesType.Bar); bar2.Name = "Airplanes"; bar2.MultiBarMode = MultiBarMode.Stacked; bar2.DataLabelStyle.Visible = false; // add the third bar NBarSeries bar3 = (NBarSeries)chart1.Series.Add(SeriesType.Bar); bar3.Name = "Trains"; bar3.MultiBarMode = MultiBarMode.Stacked; bar3.DataLabelStyle.Visible = false; // add the fourth bar NBarSeries bar4 = (NBarSeries)chart1.Series.Add(SeriesType.Bar); bar4.Name = "Buses"; bar4.MultiBarMode = MultiBarMode.Stacked; bar4.DataLabelStyle.Visible = false; // change the color of the second and third bars bar1.Values.FillRandomRange(Random, 5, 20, 100); bar2.Values.FillRandomRange(Random, 5, 20, 100); bar3.Values.FillRandomRange(Random, 5, 20, 100); bar4.Values.FillRandomRange(Random, 5, 20, 100); // add a pie chart NChart chart2 = new NPieChart(); nChartControl1.Charts.Add(chart2); chart2.Tag = "PieChart"; chart2.Location = new NPointL(new NLength(55, NRelativeUnit.ParentPercentage), new NLength(8, NRelativeUnit.ParentPercentage)); chart2.Size = new NSizeL(new NLength(45, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage)); chart2.BoundsMode = BoundsMode.Fit; chart2.Projection.Zoom = 80; NPieSeries pie = (NPieSeries)chart2.Series.Add(SeriesType.Pie); pie.DataLabelStyle.Visible = false; pie.AddDataPoint(new NDataPoint(12)); pie.AddDataPoint(new NDataPoint(42)); pie.AddDataPoint(new NDataPoint(56)); pie.AddDataPoint(new NDataPoint(23)); // apply style sheet NStyleSheet styleSheet1 = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet1.Apply(chart1); NStyleSheet styleSheet2 = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet2.Apply(chart2); } }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = new NLabel("Graphics Path Series"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; int shapeIndex = 0; double cellSize = 100; double shapePadding = 10; NChartPalette palette = new NChartPalette(ChartPredefinedPalette.Nevron); for (int x = 0; x < 2; x++) { for (int y = 0; y < 2; y++) { NGraphicsPathSeries graphicsPathSeries = new NGraphicsPathSeries(); double xmin = x * cellSize + shapePadding; double ymin = y * cellSize + shapePadding; double xmax = xmin + cellSize - shapePadding; double ymax = ymin + cellSize - shapePadding; double shapeSize = cellSize - 2 * shapePadding; NGraphicsPath path = new NGraphicsPath(); switch (shapeIndex) { case 0: // rectangle graphicsPathSeries.Name = "Rectangle"; path.AddRectangle(xmin, ymin, xmax - xmin, ymax - ymin); graphicsPathSeries.InteractivityStyle = new NInteractivityStyle("Rectangle"); break; case 1: // ellipse graphicsPathSeries.Name = "Ellipse"; path.AddEllipse(xmin, ymin, xmax - xmin, ymax - ymin); graphicsPathSeries.InteractivityStyle = new NInteractivityStyle("Ellipse"); break; case 2: // triangle graphicsPathSeries.Name = "Triangle"; graphicsPathSeries.InteractivityStyle = new NInteractivityStyle("Triangle"); path.StartFigure((xmin + xmax) / 2.0, ymin); path.LineTo(xmin, ymax); path.LineTo(xmax, ymax); path.CloseFigure(); break; case 3: // polygon graphicsPathSeries.Name = "Polygon"; graphicsPathSeries.InteractivityStyle = new NInteractivityStyle("Polygon"); double xcenter = (xmin + xmax) / 2.0; double ycenter = (ymin + ymax) / 2.0; int count = 8; double radius = shapeSize / 2; for (int i = 0; i < count; i++) { double angle = Math.PI * 2 * (double)i / (double)count; if (i == 0) { path.StartFigure(xcenter + Math.Cos(angle) * radius, ycenter + Math.Sin(angle) * radius); } else { path.LineTo(xcenter + Math.Cos(angle) * radius, ycenter + Math.Sin(angle) * radius); } } path.CloseFigure(); break; } graphicsPathSeries.FillStyle = new NColorFillStyle(palette.SeriesColors[shapeIndex]); graphicsPathSeries.GraphicsPath = path; chart.Series.Add(graphicsPathSeries); shapeIndex++; } } ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]); nChartControl1.Controller.Tools.Add(new NTooltipTool()); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Init Form controls WebExamplesUtilities.FillComboWithValues(SampleDistanceDropDownList, 1, 10, 1); SampleDistanceDropDownList.SelectedIndex = 0; UseXValuesCheckBox.Checked = true; WebExamplesUtilities.FillComboWithValues(NumberOfTurnsDropDownList, 3, 20, 1); NumberOfTurnsDropDownList.SelectedIndex = 2; WebExamplesUtilities.FillComboWithValues(NumberOfPointsInTurnDropDownList, 10000, 30000, 10000); NumberOfPointsInTurnDropDownList.SelectedIndex = 1; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("2D Sampled Line Chart"); 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.BoundsMode = BoundsMode.Stretch; // setup Y axis NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; // setup X axis NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator(); scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Floor }; scaleX.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); scaleX.StripStyles.Add(stripStyle); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // add the line NAreaSeries area = (NAreaSeries)chart.Series.Add(SeriesType.Area); area.Name = "Area Series"; area.DataLabelStyle.Visible = false; area.MarkerStyle.Visible = false; area.Legend.Mode = SeriesLegendMode.None; // instruct the series to use X values area.UseXValues = UseXValuesCheckBox.Checked; // update sampling parameters area.SamplingMode = SeriesSamplingMode.Enabled; area.SampleDistance = new NLength((float)SampleDistanceDropDownList.SelectedIndex + 1, NGraphicsUnit.Pixel); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); GenerateXYData(area); NumberOfDataPointsLabel.Text = "Number of Data Points:" + (area.Values.Count / 1000).ToString() + "K"; // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }