protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { CountryDropDownList.Items.Add("USA"); CountryDropDownList.Items.Add("CHINA"); CountryDropDownList.Items.Add("JAPAN"); CountryDropDownList.Items.Add("GERMANY"); CountryDropDownList.Items.Add("FRANCE"); CountryDropDownList.Items.Add("UK"); CountryDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithPercents(XPositionDropDownList, 10); XPositionDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithPercents(YPositionDropDownList, 10); YPositionDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithPercents(FlagTransparencyDropDownList, 10); FlagTransparencyDropDownList.SelectedIndex = 5; ContentAlignmentDropDownList.Items.Add("BottomCenter"); ContentAlignmentDropDownList.Items.Add("BottomLeft"); ContentAlignmentDropDownList.Items.Add("BottomRight"); ContentAlignmentDropDownList.Items.Add("MiddleCenter"); ContentAlignmentDropDownList.Items.Add("MiddleLeft"); ContentAlignmentDropDownList.Items.Add("MiddleRight"); ContentAlignmentDropDownList.Items.Add("TopCenter"); ContentAlignmentDropDownList.Items.Add("TopLeft"); ContentAlignmentDropDownList.Items.Add("TopRight"); ContentAlignmentDropDownList.SelectedIndex = 2; } // enable the antialiasing of the whole scene nChartControl1.Settings.JitterMode = JitterMode.Enabled; nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // by default the chart contains a cartesian chart which cannot display a pie series nChartControl1.Charts.Clear(); // create the legend NLegend legend = new NLegend(); legend.HorizontalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.VerticalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.FillStyle.SetTransparencyPercent(50); 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.SetPredefinedLegendStyle(PredefinedLegendStyle.TopRight); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Car sales for " + CountryDropDownList.SelectedItem.Text); title.ContentAlignment = ContentAlignment.TopRight; title.Location = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(98, NRelativeUnit.ParentPercentage)); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // create the watermark NWatermark watermark = new NWatermark(); watermark.FillStyle = new NImageFillStyle(this.MapPathSecure(this.TemplateSourceDirectory + "\\" + CountryDropDownList.SelectedItem.Text + ".GIF")); watermark.Location = new NPointL(new NLength(XPositionDropDownList.SelectedIndex * 10, NRelativeUnit.ParentPercentage), new NLength(YPositionDropDownList.SelectedIndex * 10, NRelativeUnit.ParentPercentage)); watermark.UseAutomaticSize = false; watermark.Size = new NSizeL(150, 100); watermark.ContentAlignment = (ContentAlignment)ContentAlignment.Parse(typeof(ContentAlignment), ContentAlignmentDropDownList.SelectedItem.Text); watermark.FillStyle.SetTransparencyPercent(FlagTransparencyDropDownList.SelectedIndex * 10.0f); watermark.StandardFrameStyle.Visible = false; // create the chart NPieChart chart = new NPieChart(); chart.Enable3D = true; chart.Depth = 5; if (ShowFlagAboveChartBox.Checked) { nChartControl1.Panels.Add(chart); nChartControl1.Panels.Add(legend); nChartControl1.Panels.Add(watermark); } else { nChartControl1.Panels.Add(watermark); nChartControl1.Panels.Add(chart); nChartControl1.Panels.Add(legend); } chart.DisplayOnLegend = legend; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.MetallicLustre); chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveElevated); NPieSeries pie = (NPieSeries)chart.Series.Add(SeriesType.Pie); pie.PieStyle = PieStyle.SmoothEdgePie; pie.LabelMode = PieLabelMode.Center; pie.Legend.Mode = SeriesLegendMode.DataPoints; pie.DataLabelStyle.Visible = false; pie.AddDataPoint(new NDataPoint(0, "Toyota")); pie.AddDataPoint(new NDataPoint(0, "Honda")); pie.AddDataPoint(new NDataPoint(0, "Volkswagen")); pie.AddDataPoint(new NDataPoint(0, "Chrysler")); pie.AddDataPoint(new NDataPoint(0, "Ford")); pie.Values.FillRandom(Random, 5); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(pie); }
public override void Initialize() { base.Initialize(); nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Series Z Order"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); header.DockMode = PanelDockMode.Top; header.Margins = new NMarginsL(0, 10, 0, 10); nChartControl1.Panels.Add(header); NLegend legend = new NLegend(); legend.DockMode = PanelDockMode.Right; legend.Margins = new NMarginsL(0, 0, 10, 0); nChartControl1.Panels.Add(legend); // create the chart m_Chart = new NCartesianChart(); nChartControl1.Panels.Add(m_Chart); m_Chart.DockMode = PanelDockMode.Fill; m_Chart.BoundsMode = BoundsMode.Stretch; m_Chart.Margins = new NMarginsL(40, 10, 20, 30); m_Chart.DisplayOnLegend = legend; m_Chart.Axis(StandardAxis.Depth).Visible = false; // add the first bar m_Bar1 = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar); m_Bar1.WidthPercent = 80; m_Bar1.Name = "Bar1"; // add the second bar m_Bar2 = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar); m_Bar2.WidthPercent = 60; m_Bar2.Name = "Bar2"; // add the third bar m_Bar3 = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar); m_Bar3.WidthPercent = 40; m_Bar3.Name = "Bar3"; // position data labels in the center of the bars m_Bar1.DataLabelStyle.Visible = false; m_Bar2.DataLabelStyle.Visible = false; m_Bar3.DataLabelStyle.Visible = false; // fill some random data m_Bar1.Values.FillRandomRange(Random, 6, 20, 100); m_Bar2.Values.FillRandomRange(Random, 6, 20, 100); m_Bar3.Values.FillRandomRange(Random, 6, 20, 100); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // init form controls ZOrderModeCombo.Items.Add("123"); ZOrderModeCombo.Items.Add("321"); ZOrderModeCombo.SelectedIndex = 0; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumNames(ContourDisplayModeDropDownList, typeof(ContourDisplayMode)); WebExamplesUtilities.FillComboWithEnumNames(ContourColorModeDropDownList, typeof(ContourColorMode)); ShowFillCheckBox.Checked = true; SmoothPaletteCheckBox.Checked = true; ContourDisplayModeDropDownList.SelectedIndex = (int)ContourDisplayMode.Contour; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Panels.Clear(); // set a chart title NLabel title = new NLabel("Heat Map - Contour"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.DockMode = PanelDockMode.Top; title.Margins = new NMarginsL(0, 5, 0, 0); nChartControl1.Panels.Add(title); NLegend legend = new NLegend(); legend.DockMode = PanelDockMode.Right; legend.Margins = new NMarginsL(0, 5, 5, 0); legend.FitAlignment = ContentAlignment.TopCenter; nChartControl1.Panels.Add(legend); NCartesianChart chart = new NCartesianChart(); nChartControl1.Panels.Add(chart); chart.DisplayOnLegend = legend; chart.DockMode = PanelDockMode.Fill; chart.BoundsMode = BoundsMode.Stretch; chart.Margins = new NMarginsL(5); NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator(); scaleX.RoundToTickMin = false; scaleX.RoundToTickMax = false; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator(); scaleY.RoundToTickMin = false; scaleY.RoundToTickMax = false; chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY; // create the heat map // create the heat map NTriangulatedHeatMapSeries heatMap = new NTriangulatedHeatMapSeries(); chart.Series.Add(heatMap); heatMap.Palette.Add(0.0, Color.Purple); heatMap.Palette.Add(1.5, Color.MediumSlateBlue); heatMap.Palette.Add(3.0, Color.CornflowerBlue); heatMap.Palette.Add(4.5, Color.LimeGreen); heatMap.Palette.Add(6.0, Color.LightGreen); heatMap.Palette.Add(7.5, Color.Yellow); heatMap.Palette.Add(9.0, Color.Orange); heatMap.Palette.Add(10.5, Color.Red); heatMap.ContourDisplayMode = ContourDisplayMode.Contour; heatMap.Legend.Mode = SeriesLegendMode.SeriesLogic; heatMap.Legend.Format = "<zone_value>"; heatMap.ContourDisplayMode = ContourDisplayMode.Contour; heatMap.Legend.Mode = SeriesLegendMode.SeriesLogic; heatMap.Legend.Format = "<zone_value>"; GenerateData(heatMap); // update chart control from form controls heatMap.ContourDisplayMode = (ContourDisplayMode)ContourDisplayModeDropDownList.SelectedIndex; heatMap.ContourColorMode = (ContourColorMode)ContourColorModeDropDownList.SelectedIndex; heatMap.ShowFill = ShowFillCheckBox.Checked; heatMap.Palette.SmoothPalette = SmoothPaletteCheckBox.Checked; if (heatMap.Palette.SmoothPalette) { heatMap.Legend.Format = "<zone_value>"; } else { heatMap.Legend.Format = "<zone_begin> - <zone_end>"; } }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Panels.Clear(); // set a chart title NLabel title = new NLabel("Heat Map"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.DockMode = PanelDockMode.Top; title.Margins = new NMarginsL(0, 5, 0, 0); nChartControl1.Panels.Add(title); NLegend legend = new NLegend(); legend.DockMode = PanelDockMode.Right; legend.Margins = new NMarginsL(0, 5, 5, 0); legend.FitAlignment = ContentAlignment.TopCenter; nChartControl1.Panels.Add(legend); NCartesianChart chart = new NCartesianChart(); nChartControl1.Panels.Add(chart); chart.DisplayOnLegend = legend; chart.DockMode = PanelDockMode.Fill; chart.BoundsMode = BoundsMode.Stretch; chart.Margins = new NMarginsL(5); // create the heat map (will be updated on timer tick) NHeatMapSeries heatMap = new NHeatMapSeries(); heatMap.Data.SetGridSize(m_SizeX, m_SizeY); heatMap.Data.SetValues(double.NaN); heatMap.Legend.Mode = SeriesLegendMode.SeriesLogic; // used to display palette information heatMap.Legend.PaletteLegendMode = PaletteLegendMode.GradientAxis; heatMap.Legend.PaletteScaleStepMode = PaletteScaleStepMode.SynchronizeWithScaleConfigurator; heatMap.Legend.PaletteLength = new NLength(170); NNumericScaleConfigurator numericScale = heatMap.Legend.PaletteScaleConfigurator as NNumericScaleConfigurator; numericScale.MajorTickMode = MajorTickMode.CustomStep; numericScale.CustomStep = 10; heatMap.Palette.Mode = PaletteMode.AutoMinMaxColor; heatMap.Palette.PositiveColor = Color.FromArgb(125, Color.Red); heatMap.Palette.ZeroColor = Color.FromArgb(125, Color.Blue); heatMap.Palette.SmoothPalette = true; chart.Series.Add(heatMap); // add background image NRangeSeries range = new NRangeSeries(); range.UseXValues = true; range.DataLabelStyle.Visible = false; range.Legend.Mode = SeriesLegendMode.None; range.Values.Add(0); range.Y2Values.Add(m_SizeY); range.XValues.Add(0); range.X2Values.Add(m_SizeX); Bitmap bitmap = new Bitmap(this.MapPathSecure(this.TemplateSourceDirectory + "/USMap.png")); range.FillStyle = new NImageFillStyle(bitmap); chart.Series.Add(range); // then create some dummy data CreateDymmyData(heatMap); }
protected void Page_Load(object sender, System.EventArgs e) { if (nChartControl1.RequiresInitialization) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; // configure legend NLegend legend = nChartControl1.Legends[0]; legend.ShadowStyle.Type = ShadowType.GaussianBlur; legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Left); legend.DockMode = PanelDockMode.Bottom; legend.Margins = new NMarginsL(0, 0, 0, 10); legend.Data.ExpandMode = LegendExpandMode.ColsFixed; legend.Data.ColCount = 2; // set a chart title NLabel header = nChartControl1.Labels.AddHeader("Product Analysis"); 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(3, NRelativeUnit.ParentPercentage), new NLength(3, NRelativeUnit.ParentPercentage)); // by default the chart contains a cartesian chart which cannot display pie series NPieChart chart = new NPieChart(); chart.Enable3D = true; nChartControl1.Charts.Clear(); nChartControl1.Charts.Add(chart); chart.DisplayOnLegend = nChartControl1.Legends[0]; NPieSeries pie = (NPieSeries)chart.Series.Add(SeriesType.Pie); pie.AddDataPoint(new NDataPoint(23, ".NET Vision")); pie.AddDataPoint(new NDataPoint(56, "Chart")); pie.AddDataPoint(new NDataPoint(42, "Diagram")); pie.AddDataPoint(new NDataPoint(12, "User Interface")); pie.Legend.Mode = SeriesLegendMode.DataPoints; pie.Legend.Format = "<label> <percent>"; pie.PieStyle = PieStyle.SmoothEdgePie; pie.LabelMode = PieLabelMode.Spider; pie.LabelMode = PieLabelMode.Center; pie.DataLabelStyle.ArrowLength = new NLength(0f, NRelativeUnit.ParentPercentage); pie.DataLabelStyle.ArrowPointerLength = new NLength(0f, NRelativeUnit.ParentPercentage); chart.LightModel.EnableLighting = true; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.MetallicLustre); chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveElevated); chart.BoundsMode = BoundsMode.Fit; chart.Location = new NPointL( new NLength(10, NRelativeUnit.ParentPercentage), new NLength(10, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL( new NLength(80, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage)); // set up client side redirects pie.InteractivityStyles.Add(0, new NInteractivityStyle(true, null, null, CursorType.Default, "http://www.nevron.com/Products.Nevron.NETVision.Overview.aspx")); pie.InteractivityStyles.Add(1, new NInteractivityStyle(true, null, null, CursorType.Default, "http://www.nevron.com/Products.ChartFor.NET.Overview.aspx")); pie.InteractivityStyles.Add(2, new NInteractivityStyle(true, null, null, CursorType.Default, "http://www.nevron.com/Products.DiagramFor.NET.Overview.aspx")); pie.InteractivityStyles.Add(3, new NInteractivityStyle(true, null, null, CursorType.Default, "http://www.nevron.com/Products.UserInterfaceFor.NET.Overview.aspx")); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithPercents(WidthPercentDropDownList, 10); WidthPercentDropDownList.SelectedIndex = 7; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Gantt"); 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.HorizontalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.VerticalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); // configure the chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; chart.Projection.ViewerRotation = 270; // setup the value axis NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); dateTimeScale.EnableUnitSensitiveFormatting = false; dateTimeScale.LabelValueFormatter = new NDateTimeValueFormatter("d MMM"); dateTimeScale.MajorTickMode = MajorTickMode.CustomStep; dateTimeScale.CustomStep = new NDateTimeSpan(1, NDateTimeUnit.Week); dateTimeScale.LabelStyle.TextStyle.FontStyle.EmSize = new NLength(8); dateTimeScale.LabelStyle.Angle = new NScaleLabelAngle(90); dateTimeScale.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; // add interlaced stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; stripStyle.Interlaced = true; dateTimeScale.StripStyles.Add(stripStyle); chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = dateTimeScale; chart.Axis(StandardAxis.PrimaryY).Anchor = new NDockAxisAnchor(AxisDockZone.FrontRight, true, 0, 100); // label the X axis NOrdinalScaleConfigurator ordinalScale = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator; ordinalScale.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; ordinalScale.LabelStyle.TextStyle.FontStyle.EmSize = new NLength(8); ordinalScale.MajorTickMode = MajorTickMode.AutoMaxCount; ordinalScale.AutoLabels = false; ordinalScale.Labels.Add("Market Research"); ordinalScale.Labels.Add("Specifications"); ordinalScale.Labels.Add("Architecture"); ordinalScale.Labels.Add("Project Planning"); ordinalScale.Labels.Add("Detailed Design"); ordinalScale.Labels.Add("Development"); ordinalScale.Labels.Add("Test Plan"); ordinalScale.Labels.Add("Testing and QA"); ordinalScale.Labels.Add("Documentation"); // create a floatbar series NFloatBarSeries floatBar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar); floatBar.BeginValues.ValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.Date); floatBar.EndValues.ValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.Date); floatBar.DataLabelStyle.Visible = false; AddDataPoint(floatBar, new DateTime(2009, 2, 2), new DateTime(2009, 2, 16)); AddDataPoint(floatBar, new DateTime(2009, 2, 16), new DateTime(2009, 3, 2)); AddDataPoint(floatBar, new DateTime(2009, 3, 2), new DateTime(2009, 3, 16)); AddDataPoint(floatBar, new DateTime(2009, 3, 9), new DateTime(2009, 3, 23)); AddDataPoint(floatBar, new DateTime(2009, 3, 16), new DateTime(2009, 3, 30)); AddDataPoint(floatBar, new DateTime(2009, 3, 23), new DateTime(2009, 4, 27)); AddDataPoint(floatBar, new DateTime(2009, 4, 13), new DateTime(2009, 4, 27)); AddDataPoint(floatBar, new DateTime(2009, 4, 20), new DateTime(2009, 5, 4)); AddDataPoint(floatBar, new DateTime(2009, 4, 27), new DateTime(2009, 5, 4)); floatBar.WidthPercent = WidthPercentDropDownList.SelectedIndex * 10; // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { 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("3D Pie Chart Shapes"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // setup the legend NLegend legend = nChartControl1.Legends[0]; legend.SetPredefinedLegendStyle(PredefinedLegendStyle.BottomRight); NPieChart pieChart = new NPieChart(); pieChart.Enable3D = true; nChartControl1.Charts.Clear(); nChartControl1.Charts.Add(pieChart); NPointLightSource ls = new NPointLightSource(); ls.CoordinateMode = LightSourceCoordinateMode.Camera; ls.Position = new NVector3DF(0, 0, 50); ls.Ambient = Color.FromArgb(30, 30, 30); ls.Diffuse = Color.FromArgb(180, 180, 180); ls.Specular = Color.FromArgb(100, 100, 100); pieChart.LightModel.LightSources.Clear(); pieChart.LightModel.LightSources.Add(ls); pieChart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveElevated); pieChart.Depth = 10; pieChart.DisplayOnLegend = nChartControl1.Legends[0]; pieChart.Location = new NPointL(new NLength(20, NRelativeUnit.ParentPercentage), new NLength(20, NRelativeUnit.ParentPercentage)); pieChart.Size = new NSizeL(new NLength(60, NRelativeUnit.ParentPercentage), new NLength(60, NRelativeUnit.ParentPercentage)); pieChart.InnerRadius = new NLength(20, NRelativeUnit.ParentPercentage); NPieSeries pieSeries = (NPieSeries)pieChart.Series.Add(SeriesType.Pie); pieSeries.BorderStyle.Color = Color.LemonChiffon; pieSeries.DataLabelStyle.ArrowLength = new NLength(10, NGraphicsUnit.Point); pieSeries.DataLabelStyle.ArrowPointerLength = new NLength(0, NGraphicsUnit.Point); pieSeries.Legend.Mode = SeriesLegendMode.DataPoints; pieSeries.Legend.Format = "<label> <percent>"; pieSeries.AddDataPoint(new NDataPoint(24, "Cars", new NColorFillStyle(Color.FromArgb(169, 121, 11)))); pieSeries.AddDataPoint(new NDataPoint(18, "Airplanes", new NColorFillStyle(Color.FromArgb(157, 157, 92)))); pieSeries.AddDataPoint(new NDataPoint(32, "Trains", new NColorFillStyle(Color.FromArgb(98, 152, 92)))); pieSeries.AddDataPoint(new NDataPoint(23, "Ships", new NColorFillStyle(Color.FromArgb(111, 134, 181)))); pieSeries.AddDataPoint(new NDataPoint(19, "Buses", new NColorFillStyle(Color.FromArgb(179, 63, 92)))); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.BrightMultiColor); styleSheet.Apply(nChartControl1.Document); // init controls NExampleHelpers.FillComboWithEnumValues(PieShapeComboBox, typeof(PieStyle)); PieShapeComboBox.SelectedIndex = (int)PieStyle.Ring; NExampleHelpers.FillComboWithEnumValues(LabelModeComboBox, typeof(PieLabelMode)); LabelModeComboBox.SelectedIndex = 0; EdgePercentScrollBar.Value = pieSeries.PieEdgePercent / 100.0f; OuterRadiusScrollBar.Value = pieChart.Radius.Value / 100.0f; InnerRadiusScrollBar.Value = pieChart.InnerRadius.Value / 100.0f; ArrowLengthScrollBar.Value = pieSeries.DataLabelStyle.ArrowLength.Value / 100.0f; ArrowPointerLengthScrollBar.Value = pieSeries.DataLabelStyle.ArrowPointerLength.Value / 100.0f; LabelConnectorLengthScrollBar.Value = pieSeries.ConnectorLength.Value / 100.0f; LeadOffArrowLengthScrollBar.Value = pieSeries.LeadOffArrowLength.Value / 100.0f; BeginAngleScrollBar.Value = pieChart.BeginAngle / 360.0; TotalAngleScrollBar.Value = pieChart.TotalAngle / 360.0; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ShowNorthAmericaCheckBox.Checked = true; ShowEuropeCheckBox.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Company Sales by Region<br/><font size = '9pt'>Demonstrates how to use custom range labels to denote ranges on a scale</font>"); 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.DockMode = PanelDockMode.Top; header.FitAlignment = ContentAlignment.MiddleLeft; header.Margins = new NMarginsL(5, 0, 10, 10); header.Location = new NPointL(new NLength(3, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); nChartControl1.Panels.Add(header); NCartesianChart chart = new NCartesianChart(); nChartControl1.Panels.Add(chart); // configure the legend and add it as child panel of the chart NLegend legend = new NLegend(); legend.Margins = new NMarginsL(10, 0, 10, 0); legend.DockMode = PanelDockMode.Right; legend.FitAlignment = ContentAlignment.TopCenter; legend.Data.ExpandMode = LegendExpandMode.ColsOnly; legend.FillStyle = new NColorFillStyle(Color.FromArgb(125, Color.White)); legend.HorizontalBorderStyle.Width = new NLength(0); legend.VerticalBorderStyle.Width = new NLength(0); legend.OuterTopBorderStyle.Width = new NLength(0); legend.OuterLeftBorderStyle.Width = new NLength(0); legend.OuterBottomBorderStyle.Width = new NLength(0); legend.OuterRightBorderStyle.Width = new NLength(0); chart.ChildPanels.Add(legend); chart.DisplayOnLegend = legend; chart.DockMode = PanelDockMode.Fill; chart.BoundsMode = BoundsMode.Stretch; chart.Margins = new NMarginsL(2, 0, 2, 2); chart.Axis(StandardAxis.Depth).Visible = false; // add range selection NRangeSelection rangeSelection = new NRangeSelection(); rangeSelection.VerticalValueSnapper = new NAxisRulerMinMaxSnapper(); chart.RangeSelections.Add(rangeSelection); // add the first bar m_Bar1 = (NBarSeries)chart.Series.Add(SeriesType.Bar); m_Bar1.Name = "Coca Cola"; m_Bar1.MultiBarMode = MultiBarMode.Series; m_Bar1.DataLabelStyle.Format = "<value>"; // add the second bar m_Bar2 = (NBarSeries)chart.Series.Add(SeriesType.Bar); m_Bar2.Name = "Pepsi"; m_Bar2.MultiBarMode = MultiBarMode.Clustered; m_Bar2.DataLabelStyle.Format = "<value>"; // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // add custom labels to the X axis NAxis xAxis = chart.Axis(StandardAxis.PrimaryX); xAxis.ScrollBar.Visible = true; NOrdinalScaleConfigurator ordinalScale = xAxis.ScaleConfigurator as NOrdinalScaleConfigurator; ordinalScale.AutoLabels = false; ordinalScale.OuterMajorTickStyle.Visible = false; ordinalScale.InnerMajorTickStyle.Visible = false; // add custom labels to the Y axis chart.Axis(StandardAxis.PrimaryY).View = new NRangeAxisView(new NRange1DD(0, 320)); NLinearScaleConfigurator linearScale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; linearScale.RoundToTickMax = false; NCustomRangeLabel rangeLabel = new NCustomRangeLabel(new NRange1DD(240, 320), "Target Volume"); rangeLabel.Style.TickMode = RangeLabelTickMode.Center; rangeLabel.Style.WrapText = true; rangeLabel.Style.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0); linearScale.CustomLabels.Add(rangeLabel); // 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); UpdateRegions(); }
internal void ApplyLayoutTemplate(int template, NChart chart, NLabel title, NLegend legend) { nChartControl1.Panels.Clear(); if (title != null) { nChartControl1.Panels.Add(title); title.Dock = DockStyle.Top; title.Padding = new NMarginsL(5, 8, 5, 4); } if (legend != null) { nChartControl1.Panels.Add(legend); legend.Dock = DockStyle.Right; legend.Padding = new NMarginsL(1, 1, 5, 5); } if (chart != null) { nChartControl1.Panels.Add(chart); float topPad = (title == null) ? 11 : 8; float rightPad = (legend == null) ? 11 : 4; if (chart.Enable3D || (chart.BoundsMode == BoundsMode.None)) { chart.BoundsMode = BoundsMode.Fit; } chart.Dock = DockStyle.Fill; chart.Padding = new NMarginsL( new NLength(11, NRelativeUnit.ParentPercentage), new NLength(topPad, NRelativeUnit.ParentPercentage), new NLength(rightPad, NRelativeUnit.ParentPercentage), new NLength(11, NRelativeUnit.ParentPercentage)); } }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { // set a chart title NLabel title = nChartControl1.Labels.AddHeader("3D Funnel Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(Color.SteelBlue); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); NLegend legend = nChartControl1.Legends[0]; legend.SetPredefinedLegendStyle(PredefinedLegendStyle.BottomRight); NFunnelChart chart = new NFunnelChart(); chart.Enable3D = true; chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.NorthernLights); chart.Projection.Elevation = 4; nChartControl1.Charts.Clear(); nChartControl1.Charts.Add(chart); NFunnelSeries funnel = (NFunnelSeries)chart.Series.Add(SeriesType.Funnel); funnel.BorderStyle.Color = Color.LemonChiffon; funnel.Legend.DisplayOnLegend = legend; funnel.Legend.Mode = SeriesLegendMode.DataPoints; funnel.DataLabelStyle.Format = "<percent>"; funnel.Values.Add(20.0); funnel.Values.Add(10.0); funnel.Values.Add(15.0); funnel.Values.Add(7.0); funnel.Values.Add(28.0); funnel.Labels.Add("Awareness"); funnel.Labels.Add("First Hear"); funnel.Labels.Add("Further Learn"); funnel.Labels.Add("Liking"); funnel.Labels.Add("Decision"); // apply palette to funnel segments NChartPalette palette = new NChartPalette(ChartPredefinedPalette.Fresh); for (int i = 0; i < funnel.Values.Count; i++) { funnel.FillStyles[i] = new NColorFillStyle(palette.SeriesColors[i % palette.SeriesColors.Count]); } // init form controls NExampleHelpers.FillComboWithEnumValues(FunnelLabelModeComboBox, typeof(FunnelLabelMode)); FunnelLabelModeComboBox.SelectedIndex = 0; FunnelRadiusScrollBar.Value = chart.Width / 100.0f; FunnelPointGapScrollBar.Value = funnel.FunnelPointGap / 10.0f; NeckWidthScrollBar.Value = funnel.NeckWidthPercent / 100.0f; NeckHeightScrollBar.Value = funnel.NeckHeightPercent / 100.0f; LabelArrowLengthScrollBar.Value = funnel.DataLabelStyle.ArrowLength.Value / 100.0f; }
public override void Initialize(NThinChartControl control) { NServerMouseEventTool serverMouseEventTool; // enable jittering (full scene antialiasing) control.Settings.JitterMode = JitterMode.Enabled; control.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = control.Labels.AddHeader("Exploded 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 = control.Legends[0]; legend.FillStyle.SetTransparencyPercent(50); legend.Data.ExpandMode = LegendExpandMode.RowsFixed; legend.Data.RowCount = 2; legend.ContentAlignment = ContentAlignment.TopLeft; legend.Location = new NPointL( new NLength(99, NRelativeUnit.ParentPercentage), new NLength(99, NRelativeUnit.ParentPercentage)); // by default the control contains a Cartesian chart -> remove it and create a Pie chart NChart chart = new NPieChart(); control.Charts.Clear(); control.Charts.Add(chart); // configure the chart chart.Enable3D = true; chart.DisplayOnLegend = control.Legends[0]; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.MetallicLustre); chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalElevated); chart.BoundsMode = BoundsMode.Fit; chart.Location = new NPointL( new NLength(12, NRelativeUnit.ParentPercentage), new NLength(12, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL( new NLength(76, NRelativeUnit.ParentPercentage), new NLength(68, NRelativeUnit.ParentPercentage)); // add a pie serires NPieSeries pie = (NPieSeries)chart.Series.Add(SeriesType.Pie); pie.PieStyle = PieStyle.SmoothEdgePie; pie.PieEdgePercent = 50; pie.DataLabelStyle.Visible = false; pie.Legend.Mode = SeriesLegendMode.DataPoints; pie.Legend.Format = "<label> <percent>"; pie.Legend.TextStyle.FontStyle = new NFontStyle("Arial", 8); pie.AddDataPoint(new NDataPoint(0, "Ships")); pie.AddDataPoint(new NDataPoint(0, "Trains")); pie.AddDataPoint(new NDataPoint(0, "Cars")); pie.AddDataPoint(new NDataPoint(0, "Buses")); pie.AddDataPoint(new NDataPoint(0, "Airplanes")); pie.Values.FillRandomRange(new Random(), pie.Values.Count, 1, 20); for (int i = 0; i < pie.Values.Count; i++) { pie.Detachments.Add(0); } // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.NevronMultiColor); styleSheet.Apply(control.Document); // configure the controller serverMouseEventTool = new NServerMouseEventTool(); control.Controller.Tools.Add(serverMouseEventTool); serverMouseEventTool.MouseDown = new NDetachPieSliceMouseEventCallback(); }
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("Grid Surface Chart"); 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(7), new NLength(7)); // setup chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Width = 70.0f; chart.Depth = 70.0f; chart.Height = 30.0f; chart.Projection.Type = ProjectionType.Perspective; chart.Projection.Elevation = 28; chart.Projection.Rotation = -18; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft); if (!IsPostBack) { RotationTextBox.Text = chart.Projection.Rotation.ToString(); ElevationTextBox.Text = chart.Projection.Elevation.ToString(); WebExamplesUtilities.FillComboWithPercents(TransparencyDropDownList, 10); WebExamplesUtilities.FillComboWithValues(CustomValueDropDownList, 0, 20, 1); CustomValueDropDownList.SelectedIndex = 5; // form controls FrameStyleDropDownList.Items.Add("None"); FrameStyleDropDownList.Items.Add("Mesh"); FrameStyleDropDownList.Items.Add("Contour"); FrameStyleDropDownList.Items.Add("Mesh-Contour"); FrameStyleDropDownList.Items.Add("Dots"); FrameStyleDropDownList.SelectedIndex = 2; PositionModeDropDownList.Items.Add("Axis Begin"); PositionModeDropDownList.Items.Add("Axis End"); PositionModeDropDownList.Items.Add("Custom Value"); PositionModeDropDownList.SelectedIndex = 0; smoothShadingCheck.Checked = true; } else { chart.Projection.Rotation = (float)Convert.ToDouble(RotationTextBox.Text); chart.Projection.Elevation = (float)Convert.ToDouble(ElevationTextBox.Text); } // 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(32, 32); surface.SyncPaletteWithAxisScale = false; surface.PaletteSteps = 8; surface.ValueFormatter.FormatSpecifier = "0.0"; FillData(surface); if (SmoothPaletteCheckBox.Checked) { surface.SmoothPalette = true; surface.Legend.Format = "<zone_value>"; } else { surface.SmoothPalette = false; surface.Legend.Format = "<zone_begin> - <zone_end>"; } surface.DrawFlat = DrawFlatCheckBox.Checked; PositionModeDropDownList.Enabled = DrawFlatCheckBox.Checked; CustomValueDropDownList.Enabled = DrawFlatCheckBox.Checked; surface.FillStyle.SetTransparencyPercent(TransparencyDropDownList.SelectedIndex * 10); if (PaletteFrameCheckBox.Checked) { surface.FrameColorMode = SurfaceFrameColorMode.Zone; } else { surface.FrameColorMode = SurfaceFrameColorMode.Uniform; } surface.FrameMode = (SurfaceFrameMode)FrameStyleDropDownList.SelectedIndex; PaletteFrameCheckBox.Enabled = (surface.FrameMode != SurfaceFrameMode.None); surface.PositionMode = (SurfacePositionMode)PositionModeDropDownList.SelectedIndex; surface.PositionValue = CustomValueDropDownList.SelectedIndex; if (smoothShadingCheck.Checked) { surface.ShadingMode = ShadingMode.Smooth; } else { surface.ShadingMode = ShadingMode.Flat; } // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, legend); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithColorNames(GroupedPieColorDropDownList); GroupedPieColorDropDownList.SelectedIndex = 20; // init form controls ThresholdValueTextBox.Text = "34"; GroupedPieLabelTextBox.Text = "Other"; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Grouped 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.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.SetTransparencyPercent(70); legend.HorizontalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.VerticalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); // by default the control contains a Cartesian chart -> remove it and create a Pie chart NChart chart = new NPieChart(); nChartControl1.Charts.Clear(); nChartControl1.Charts.Add(chart); chart.Enable3D = true; chart.DisplayOnLegend = nChartControl1.Legends[0]; chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveElevated); chart.BoundsMode = BoundsMode.Fit; chart.Location = new NPointL( new NLength(20, NRelativeUnit.ParentPercentage), new NLength(20, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL( new NLength(60, NRelativeUnit.ParentPercentage), new NLength(60, NRelativeUnit.ParentPercentage)); // setup pie series NPieSeries pie = (NPieSeries)chart.Series.Add(SeriesType.Pie); pie.Legend.Mode = SeriesLegendMode.None; pie.PieStyle = PieStyle.SmoothEdgePie; int count = 10; pie.Values.FillRandomRange(Random, count, 1, 100); for (int i = 0; i < count; i++) { pie.Detachments.Add(0); pie.Labels.Add(arrLabels[i]); pie.FillStyles[i] = arrCustomColors2[i % arrCustomColors2.Length]; } if (GroupPiesCheckBox.Checked == true) { try { Color groupColor = WebExamplesUtilities.ColorFromDropDownList(GroupedPieColorDropDownList); double dGroupValue = Int32.Parse(ThresholdValueTextBox.Text); // get a subset containing the pies which are smaller than the specified value NDataSeriesSubset smallerThanValue = pie.Values.Filter(Nevron.Chart.CompareMethod.Less, dGroupValue); // determine the sum of the filtered pies double dOtherSliceValue = pie.Values.Evaluate("SUM", smallerThanValue); // remove the data points contained in the for (int i = pie.GetDataPointCount(); i >= 0; i--) { if (smallerThanValue.Contains(i)) { pie.RemoveDataPointAt(i); } } // add a detached pie with the specified group label and color NDataPoint dp = new NDataPoint(dOtherSliceValue, GroupedPieLabelTextBox.Text); dp[DataPointValue.PieDetachment] = 1.0; dp[DataPointValue.FillStyle] = new NColorFillStyle(groupColor); dp[DataPointValue.StrokeStyle] = new NStrokeStyle(1, groupColor); pie.AddDataPoint(dp); } catch { } } else { } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // init form controls WebExamplesUtilities.FillComboWithEnumValues(MarkerShapeDropDownList, typeof(PointShape)); MarkerShapeDropDownList.SelectedIndex = 0; ChartTypeDropDownList.Items.Add("Bar"); ChartTypeDropDownList.Items.Add("Line"); ChartTypeDropDownList.Items.Add("Area"); ChartTypeDropDownList.Items.Add("SmoothLine"); ChartTypeDropDownList.Items.Add("Point"); EmptyDataPointsValueModeDropDownList.Items.Add("Skip"); EmptyDataPointsValueModeDropDownList.Items.Add("Average"); EmptyDataPointsValueModeDropDownList.Items.Add("CustomValue"); EmptyDataPointsValueModeDropDownList.SelectedIndex = 0; EmptyDataPointsAppearanceDropDownList.Items.Add("None"); EmptyDataPointsAppearanceDropDownList.Items.Add("Normal"); EmptyDataPointsAppearanceDropDownList.Items.Add("Special"); EmptyDataPointsAppearanceDropDownList.SelectedIndex = 0; EmptyDataPointsMarkerModeDropDown.Items.Add("Normal Marker"); EmptyDataPointsMarkerModeDropDown.Items.Add("Special Marker"); WebExamplesUtilities.FillComboWithColorNames(EmptyDataPointsColorDropDownList, KnownColor.OrangeRed); WebExamplesUtilities.FillComboWithColorNames(MarkerColorDropDownList, KnownColor.OrangeRed); ShowMarkersCheckBox.Checked = false; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // add header NLabel header = nChartControl1.Labels.AddHeader("Empty Data Points"); 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 NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Width = 80.0f; chart.Height = 70.0f; chart.Axis(StandardAxis.Depth).Visible = false; chart.BoundsMode = BoundsMode.Stretch; chart.Location = new NPointL( new NLength(10, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL( new NLength(70, NRelativeUnit.ParentPercentage), new NLength(75, NRelativeUnit.ParentPercentage)); // configure the legend NLegend legend = nChartControl1.Legends[0]; legend.FillStyle = new NColorFillStyle(Color.FromArgb(125, 255, 255, 255)); // turn off legend grid lines 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.VerticalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.ContentAlignment = ContentAlignment.TopCenter; legend.Location = new NPointL( new NLength(88, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage)); UpdateSeriesType(); NSeries series = (NSeries)chart.Series[0]; series.MarkerStyle.Visible = ShowMarkersCheckBox.Checked; // update EDP value mode series.Values.EmptyDataPoints.ValueMode = (EmptyDataPointsValueMode)EmptyDataPointsValueModeDropDownList.SelectedIndex; series.Values.EmptyDataPoints.CustomValue = 0; // update EDP appearance mode series.EmptyDataPointsAppearance.AppearanceMode = (EmptyDataPointsAppearanceMode)EmptyDataPointsAppearanceDropDownList.SelectedIndex; // update EDP marker mode series.EmptyDataPointsAppearance.MarkerMode = (EmptyDataPointsMarkerMode)EmptyDataPointsMarkerModeDropDown.SelectedIndex; series.EmptyDataPointsAppearance.FillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(EmptyDataPointsColorDropDownList)); series.EmptyDataPointsAppearance.MarkerStyle.Visible = true; series.EmptyDataPointsAppearance.MarkerStyle.PointShape = (PointShape)MarkerShapeDropDownList.SelectedIndex; series.EmptyDataPointsAppearance.MarkerStyle.FillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(MarkerColorDropDownList)); series.EmptyDataPointsAppearance.MarkerStyle.Width = new NLength(2f, NRelativeUnit.ParentPercentage); series.EmptyDataPointsAppearance.MarkerStyle.Depth = new NLength(2f, NRelativeUnit.ParentPercentage); series.EmptyDataPointsAppearance.MarkerStyle.Height = new NLength(2f, NRelativeUnit.ParentPercentage); series.EmptyDataPointsAppearance.MarkerStyle.AutoDepth = true; }
protected void Page_Load(object sender, EventArgs e) { if (!NThinChartControl1.Initialized) { // enable jittering (full scene antialiasing) NThinChartControl1.Settings.JitterMode = JitterMode.Enabled; NThinChartControl1.Panels.Clear(); // apply background image border NThinChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = new NLabel(); NThinChartControl1.Panels.Add(title); title.DockMode = PanelDockMode.Top; title.TextStyle.TextFormat = TextFormat.XML; title.Padding = new NMarginsL(4, 6, 4, 6); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // configure the legend NLegend legend = new NLegend(); NThinChartControl1.Panels.Add(legend); legend.DockMode = PanelDockMode.Right; legend.Padding = new NMarginsL(1, 1, 3, 3); legend.FillStyle.SetTransparencyPercent(50); 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.HorizontalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.VerticalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); // configure the chart NCartesianChart chart = new NCartesianChart(); NThinChartControl1.Panels.Add(chart); chart.Enable3D = true; chart.Fit3DAxisContent = true; chart.DisplayOnLegend = legend; chart.BoundsMode = BoundsMode.Fit; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); chart.DockMode = PanelDockMode.Fill; chart.Padding = new NMarginsL( new NLength(3, NRelativeUnit.ParentPercentage), new NLength(3, NRelativeUnit.ParentPercentage), new NLength(3, NRelativeUnit.ParentPercentage), new NLength(3, NRelativeUnit.ParentPercentage)); // update the inital label text title.Text = "Trackball Tool<br/><font size='10pt'> Rotation[" + chart.Projection.Rotation.ToString() + "], Elevation [" + chart.Projection.Elevation.ToString() + "]</font>"; // setup the X axis NAxis axisX = chart.Axis(StandardAxis.PrimaryX); NOrdinalScaleConfigurator scaleX = (NOrdinalScaleConfigurator)axisX.ScaleConfigurator; scaleX.MajorTickMode = MajorTickMode.AutoMaxCount; // add interlaced stripe for the Y axis NAxis axisY = chart.Axis(StandardAxis.PrimaryY); NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)axisY.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); // hide the depth axis chart.Axis(StandardAxis.Depth).Visible = false; // add a bar series and fill it with data NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.Name = "Simple Bar Chart"; bar.BarShape = BarShape.SmoothEdgeBar; bar.Legend.Mode = SeriesLegendMode.DataPoints; bar.Legend.TextStyle.FontStyle.EmSize = new NLength(8, NGraphicsUnit.Point); bar.DataLabelStyle.Visible = false; bar.AddDataPoint(new NDataPoint(16, "Spain")); bar.AddDataPoint(new NDataPoint(42, "France")); bar.AddDataPoint(new NDataPoint(56, "Germany")); bar.AddDataPoint(new NDataPoint(23, "Italy")); bar.AddDataPoint(new NDataPoint(47, "UK")); bar.AddDataPoint(new NDataPoint(38, "Sweden")); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(bar); NTrackballTool tbt = new NTrackballTool(); tbt.Exclusive = true; tbt.Enabled = true; tbt.TrackballCallback = new TrackballCallback(); NThinChartControl1.Controller.SetActivePanel(chart); NThinChartControl1.Controller.Tools.Add(tbt); } }
public override void Initialize() { base.Initialize(); nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Series Legend Attributes"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); header.DockMode = PanelDockMode.Top; header.Margins = new NMarginsL(0, 10, 0, 10); nChartControl1.Panels.Add(header); NLegend legend = new NLegend(); legend.DockMode = PanelDockMode.Right; legend.Data.ExpandMode = LegendExpandMode.ColsFixed; legend.Data.ColCount = 2; legend.Mode = LegendMode.Automatic; legend.BoundsMode = BoundsMode.Fit; legend.Margins = new NMarginsL(0, 0, 10, 0); nChartControl1.Panels.Add(legend); // create the chart m_Chart = new NCartesianChart(); m_Chart.Enable3D = true; nChartControl1.Panels.Add(m_Chart); m_Chart.DockMode = PanelDockMode.Fill; m_Chart.BoundsMode = BoundsMode.Fit; m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); m_Chart.Margins = new NMarginsL(40, 10, 20, 30); m_Chart.DisplayOnLegend = legend; 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>"; // fill some random data m_Bar1.Values.FillRandomRange(Random, 6, 20, 100); m_Bar2.Values.FillRandomRange(Random, 6, 20, 100); m_Bar3.Values.FillRandomRange(Random, 6, 20, 100); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // init form controls FormatCombo.Items.Add("<value> <label>"); FormatCombo.Items.Add("<index> <cumulative>"); FormatCombo.Items.Add("<percent> <total>"); FormatCombo.Text = m_Bar1.Legend.Format; LegendModeCombo.FillFromEnum(typeof(SeriesLegendMode)); LegendModeCombo.SelectedIndex = (int)SeriesLegendMode.DataPoints; BarStyleCombo.FillFromEnum(typeof(BarShape)); BarStyleCombo.SelectedIndex = (int)BarShape.Bar; }
public override void Initialize(NThinChartControl control) { // enable jittering (full scene antialiasing) control.Settings.JitterMode = JitterMode.Enabled; control.Panels.Clear(); // apply background image border NImageFrameStyle frame = new NImageFrameStyle(); frame.Type = ImageFrameType.Raised; frame.BackgroundColor = Color.White; frame.BorderStyle.Color = Color.Gainsboro; control.BackgroundStyle.FrameStyle = frame; control.BackgroundStyle.FillStyle = new NGradientFillStyle(Color.White, Color.GhostWhite); // set a chart title NLabel title = new NLabel("Welcome to Nevron Chart for .NET"); control.Panels.Add(title); title.DockMode = PanelDockMode.Top; title.Padding = new NMarginsL(4, 6, 4, 6); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // configure the legend NLegend legend = new NLegend(); control.Panels.Add(legend); legend.DockMode = PanelDockMode.Right; legend.Padding = new NMarginsL(1, 1, 3, 3); legend.FillStyle.SetTransparencyPercent(50); 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.HorizontalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.VerticalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); // configure the chart NCartesianChart chart = new NCartesianChart(); control.Panels.Add(chart); chart.Enable3D = true; chart.Fit3DAxisContent = true; chart.DisplayOnLegend = legend; chart.BoundsMode = BoundsMode.Fit; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); chart.DockMode = PanelDockMode.Fill; chart.Padding = new NMarginsL( new NLength(3, NRelativeUnit.ParentPercentage), new NLength(3, NRelativeUnit.ParentPercentage), new NLength(3, NRelativeUnit.ParentPercentage), new NLength(3, NRelativeUnit.ParentPercentage)); // setup the X axis NAxis axisX = chart.Axis(StandardAxis.PrimaryX); NOrdinalScaleConfigurator scaleX = (NOrdinalScaleConfigurator)axisX.ScaleConfigurator; scaleX.MajorTickMode = MajorTickMode.AutoMaxCount; // add interlaced stripe for the Y axis NAxis axisY = chart.Axis(StandardAxis.PrimaryY); NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)axisY.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); // hide the depth axis chart.Axis(StandardAxis.Depth).Visible = false; // add a bar series and fill it with data NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.Name = "Simple Bar Chart"; bar.BarShape = BarShape.SmoothEdgeBar; bar.Legend.Mode = SeriesLegendMode.DataPoints; bar.Legend.TextStyle.FontStyle.EmSize = new NLength(8, NGraphicsUnit.Point); bar.DataLabelStyle.Visible = false; bar.AddDataPoint(new NDataPoint(16, "Spain")); bar.AddDataPoint(new NDataPoint(42, "France")); bar.AddDataPoint(new NDataPoint(56, "Germany")); bar.AddDataPoint(new NDataPoint(23, "Italy")); bar.AddDataPoint(new NDataPoint(47, "UK")); bar.AddDataPoint(new NDataPoint(38, "Sweden")); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.NevronMultiColor); styleSheet.Apply(bar); // configure toolbar control.Toolbar.Visible = true; control.Controller.SetActivePanel(chart); //control.Controller.EnableAutoUpdate = true; NTrackballTool tbt = new NTrackballTool(); tbt.Exclusive = true; tbt.Enabled = true; control.Controller.Tools.Add(tbt); control.Toolbar.Visible = true; control.Toolbar.Items.Add(new NToolbarButton(new NToggleTrackballToolAction())); }
protected void Page_Load(object sender, System.EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel header = nChartControl1.Labels.AddHeader("Custom Scale Breaks<br/> <font size = '9pt'>Demonstrates how to apply custom scale breaks to the chart axes</font>"); header.TextStyle.TextFormat = TextFormat.XML; header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Left; header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL( new NLength(2, 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]; chart.Location = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(19, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL(new NLength(92, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage)); chart.BoundsMode = BoundsMode.Stretch; Random random = new Random(); // create three random point series for (int i = 0; i < 3; i++) { NPointSeries point = new NPointSeries(); point.UseXValues = 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)); } 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)); // 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); // feed some random data UpdateScaleBreaks(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // form controls FunctionDropDownList.Items.Add("Count"); FunctionDropDownList.Items.Add("Standard Deviation"); FunctionDropDownList.Items.Add("Root Mean Square"); FunctionDropDownList.SelectedIndex = 0; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // add header NLabel header = nChartControl1.Labels.AddHeader("Functions"); 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)); // align the legend NLegend legend = nChartControl1.Legends[0]; legend.Location = new NPointL(legend.Location.X, new NLength(15, NRelativeUnit.ParentPercentage)); legend.Data.MarkSize = new NSizeL(5, 5); nFuncCalculator = new NFunctionCalculator(); nChart = nChartControl1.Charts[0]; nChart.Enable3D = true; nChart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); nChart.LightModel.SetPredefinedLightModel(PredefinedLightModel.MetallicLustre); nChart.BoundsMode = BoundsMode.Stretch; nChart.Location = new NPointL( new NLength(10, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); nChart.Size = new NSizeL( new NLength(70, NRelativeUnit.ParentPercentage), new NLength(75, NRelativeUnit.ParentPercentage)); nChart.Axis(StandardAxis.Depth).Visible = false; nChart.Wall(ChartWallType.Left).Visible = false; nChart.Wall(ChartWallType.Floor).Visible = false; // setup X axis NOrdinalScaleConfigurator ordinalScale = (NOrdinalScaleConfigurator)nChart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; ordinalScale.DisplayDataPointsBetweenTicks = false; // add a constline to diplay the function result NAxisConstLine cl = nChart.Axis(StandardAxis.PrimaryY).ConstLines.Add(); cl.StrokeStyle.Width = new NLength(2, NGraphicsUnit.Pixel); cl.StrokeStyle.Color = Color.Red; cl.Value = 0; // add the bar series nBar = (NBarSeries)nChart.Series.Add(SeriesType.Bar); nBar.Name = "Bar1"; nBar.Values.Name = "values"; nBar.Values.ValueFormatter = new NNumericValueFormatter("0.00"); nBar.MultiBarMode = MultiBarMode.Series; nBar.DataLabelStyle.Visible = false; nBar.Legend.Mode = SeriesLegendMode.DataPoints; nBar.BarShape = BarShape.Cylinder; nBar.BorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); nBar.FillStyle = new NColorFillStyle(Color.DarkSeaGreen); nBar.Values.FillRandomRange(Random, 10, 0, 20); nBar.Legend.TextStyle = new NTextStyle(new NFontStyle("Arial", 7)); // add argument nFuncCalculator.Arguments.Add(nBar.Values); nBar.Values.FillRandomRange(Random, 10, 0, 20); BuildExpression(); CalculateFunction(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { FilterDropDownList.Items.Add("More"); FilterDropDownList.Items.Add("Less"); FilterDropDownList.Items.Add("Equal"); FilterDropDownList.Items.Add("More Or Equal"); FilterDropDownList.Items.Add("Less Or Equal"); FilterDropDownList.Items.Add("Not Equal"); FilterDropDownList.SelectedIndex = 0; ValueTextBox.Text = "50"; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // add header NLabel header = nChartControl1.Labels.AddHeader("Filtering Data"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.TextStyle.FillStyle = new NColorFillStyle(Color.FromArgb(60, 90, 108)); header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL( new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // configure the chart NChart chart = nChartControl1.Charts[0]; chart.Axis(StandardAxis.Depth).Visible = false; 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(75, NRelativeUnit.ParentPercentage)); Random rnd = new Random(0); NBarSeries nBar = (NBarSeries)chart.Series.Add(SeriesType.Bar); nBar.DataLabelStyle.Format = "<value>"; nBar.Values.FillRandom(rnd, 10); // configure the legend NLegend legend = nChartControl1.Legends[0]; legend.Mode = LegendMode.Manual; legend.Data.ExpandMode = LegendExpandMode.ColsOnly; NLegendItemCellData item = new NLegendItemCellData("Filtered Data Points", LegendMarkShape.Rectangle, new NStrokeStyle(1, Color.Black), new NColorFillStyle(Color.Red), new NShadowStyle(), new NTextStyle()); legend.Data.Items.Add(item); item = new NLegendItemCellData("Series Data Points", LegendMarkShape.Rectangle, new NStrokeStyle(1, Color.Black), (NFillStyle)nBar.FillStyle.Clone(), new NShadowStyle(), new NTextStyle()); legend.Data.Items.Add(item); Filter(nBar); }
protected void Page_Load(object sender, System.EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel header = nChartControl1.Labels.AddHeader("Scale Break Appearance<br/> <font size = '9pt'>Demonstrates how to change the scale break appearance</font>"); header.TextStyle.TextFormat = TextFormat.XML; header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Left; header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL( new NLength(2, 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]; chart.Location = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(19, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL(new NLength(96, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage)); chart.BoundsMode = BoundsMode.Stretch; // configure scale NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScale.RoundToTickMax = true; linearScale.RoundToTickMin = true; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.MinTickDistance = new NLength(15); // add an interlaced strip to the Y axis NScaleStripStyle interlacedStrip = new NScaleStripStyle(); interlacedStrip.SetShowAtWall(ChartWallType.Back, true); interlacedStrip.Interlaced = true; interlacedStrip.FillStyle = new NColorFillStyle(Color.Beige); linearScale.StripStyles.Add(interlacedStrip); // Create some data with a peak in it NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.DataLabelStyle.Visible = false; // fill in some data so that it contains several peaks of data Random random = new Random(); for (int i = 0; i < 8; i++) { bar.Values.Add(random.Next(30)); } for (int i = 0; i < 5; i++) { bar.Values.Add(300 + random.Next(50)); } for (int i = 0; i < 8; i++) { bar.Values.Add(random.Next(30)); } // update form controls if (!IsPostBack) { patternDropDownList.Items.Add(ScaleBreakPattern.CenterPowerBrake.ToString()); patternDropDownList.Items.Add(ScaleBreakPattern.FreeHand.ToString()); patternDropDownList.Items.Add(ScaleBreakPattern.LeftPowerBrake.ToString()); patternDropDownList.Items.Add(ScaleBreakPattern.LongShort.ToString()); patternDropDownList.Items.Add(ScaleBreakPattern.Regular.ToString()); patternDropDownList.Items.Add(ScaleBreakPattern.RightPowerBrake.ToString()); patternDropDownList.SelectedIndex = 4; styleDropDownList.Items.Add("Line"); styleDropDownList.Items.Add("Wave"); styleDropDownList.Items.Add("ZigZag"); styleDropDownList.SelectedIndex = 1; // use wave by default lengthTextBox.Text = "5"; } UpdateScaleBreaks(); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Scale Break Appearance<br/> <font size = '9pt'>Demonstrates how to change the scale break appearance</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]; chart.Wall(ChartWallType.Back).FillStyle = new NGradientFillStyle(Color.White, Color.DarkGray); // configure scale NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScale.RoundToTickMax = true; linearScale.RoundToTickMin = true; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.MinTickDistance = new NLength(15); // add an interlaced strip to the Y axis NScaleStripStyle interlacedStrip = new NScaleStripStyle(); interlacedStrip.SetShowAtWall(ChartWallType.Back, true); interlacedStrip.Interlaced = true; interlacedStrip.FillStyle = new NColorFillStyle(Color.Beige); linearScale.StripStyles.Add(interlacedStrip); // Create some data with a peak in it NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.DataLabelStyle.Visible = false; // fill in some data so that it contains several peaks of data Random random = new Random(); for (int i = 0; i < 8; i++) { bar.Values.Add(random.Next(30)); } for (int i = 0; i < 5; i++) { bar.Values.Add(300 + random.Next(50)); } for (int i = 0; i < 8; i++) { bar.Values.Add(random.Next(30)); } nChartControl1.Refresh(); // update form controls PatternComboBox.FillFromEnum(typeof(ScaleBreakPattern)); PatternComboBox.SelectedIndex = 0; ScaleBreakStyleComboBox.Items.Add("Line"); ScaleBreakStyleComboBox.Items.Add("Wave"); ScaleBreakStyleComboBox.Items.Add("ZigZag"); ScaleBreakStyleComboBox.SelectedIndex = 1; // use wave by default HorzStepNumericUpDown.Value = 20; VertStepNumericUpDown.Value = 3; LengthUpDown.Value = 10; }
protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithValues(HotZoneBeginDropDownList, 55, 85, 5); WebExamplesUtilities.FillComboWithValues(ColdZoneEndDropDownList, 5, 45, 5); HotZoneBeginDropDownList.SelectedIndex = 3; ColdZoneEndDropDownList.SelectedIndex = 4; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel header = nChartControl1.Labels.AddHeader("Temperature Measurements <br/><font size = '8pt'>Demonstrates how to Custom Program the Scale</font>"); header.TextStyle.TextFormat = TextFormat.XML; 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)); NLegend legend = nChartControl1.Legends[0]; legend.Mode = LegendMode.Disabled; NChart chart = (NCartesianChart)nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; chart.Location = new NPointL( new NLength(2, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL( new NLength(95, NRelativeUnit.ParentPercentage), new NLength(85, NRelativeUnit.ParentPercentage)); // create a point series NPointSeries point = (NPointSeries)chart.Series.Add(SeriesType.Point); point.Name = "Point Series"; point.DataLabelStyle.Visible = false; point.MarkerStyle.Visible = false; point.Size = new NLength(5, NGraphicsUnit.Point); Random rand = new Random(); for (int i = 0; i < 30; i++) { point.Values.Add(5 + rand.Next(90)); } NAxis primaryY = chart.Axis(StandardAxis.PrimaryY); primaryY.View = new NRangeAxisView(new NRange1DD(0, 100), true, true); NLinearScaleConfigurator linearScale = primaryY.ScaleConfigurator as NLinearScaleConfigurator; linearScale.RoundToTickMax = false; linearScale.RoundToTickMin = false; UpdateScale(); }
void SetupChartLayout(string titleText) { nChartControl1.Panels.Clear(); NLabel title = new NLabel(); nChartControl1.Panels.Add(title); title.Dock = DockStyle.Top; title.Padding = new NMarginsL(5, 8, 5, 4); title.Text = titleText; title.TextStyle.FontStyle = new NFontStyle("Verdana", 12, FontStyle.Bold | FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(Color.FromArgb(68, 90, 108)); NLegend legend = new NLegend(); nChartControl1.Panels.Add(legend); legend.Dock = DockStyle.Bottom; legend.Data.ExpandMode = LegendExpandMode.ColsOnly; legend.Data.MarkSize = new NSizeL(new NLength(8), new NLength(8)); legend.Data.CellMargins = new NMarginsL(5, 3, 5, 3); legend.Padding = new NMarginsL(1, 1, 1, 7); NChart chart = new NCartesianChart(); nChartControl1.Panels.Add(chart); chart.DisplayOnLegend = legend; chart.Wall(ChartWallType.Back).FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant2, Color.White, Color.FromArgb(233, 233, 255)); chart.BoundsMode = BoundsMode.Stretch; chart.Dock = DockStyle.Fill; chart.PositionChildPanelsInContentBounds = true; chart.Padding = new NMarginsL( new NLength(6, NRelativeUnit.ParentPercentage), new NLength(6, NRelativeUnit.ParentPercentage), new NLength(6, NRelativeUnit.ParentPercentage), new NLength(6, NRelativeUnit.ParentPercentage)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { CaptureMouseEventDropDownList.Items.Add("OnClick"); CaptureMouseEventDropDownList.Items.Add("OnDblClick"); CaptureMouseEventDropDownList.Items.Add("OnMouseEnter"); CaptureMouseEventDropDownList.Items.Add("OnMouseLeave"); CaptureMouseEventDropDownList.Items.Add("Postback"); CaptureMouseEventDropDownList.SelectedIndex = 0; } NBarSeries bar; if (!NThinChartControl1.Initialized) { NThinChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel header = NThinChartControl1.Labels.AddHeader("Client Side Events Tool"); 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 legend NLegend legend = NThinChartControl1.Legends[0]; legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Right); legend.FillStyle.SetTransparencyPercent(50); legend.Location = new NPointL(new NLength(98, NRelativeUnit.ParentPercentage), legend.Location.Y); // configure the chart NChart chart = NThinChartControl1.Charts[0]; chart.Axis(StandardAxis.Depth).Visible = false; chart.BoundsMode = BoundsMode.Fit; chart.Location = new NPointL(new NLength(5, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL(new NLength(70, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage)); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft); // create a bar series bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.Name = "My Bar Series"; bar.DataLabelStyle.Format = "<value>"; bar.AddDataPoint(new NDataPoint(10, "Ford", new NColorFillStyle(WebExamplesUtilities.RandomColor()))); bar.AddDataPoint(new NDataPoint(20, "Toyota", new NColorFillStyle(WebExamplesUtilities.RandomColor()))); bar.AddDataPoint(new NDataPoint(30, "VW", new NColorFillStyle(WebExamplesUtilities.RandomColor()))); bar.AddDataPoint(new NDataPoint(25, "Mitsubishi", new NColorFillStyle(WebExamplesUtilities.RandomColor()))); bar.AddDataPoint(new NDataPoint(29, "Jaguar", new NColorFillStyle(WebExamplesUtilities.RandomColor()))); bar.Legend.Mode = SeriesLegendMode.DataPoints; bar.BarShape = BarShape.SmoothEdgeBar; bar.DataLabelStyle.Visible = false; NThinChartControl1.Controller.Tools.Add(new NClientMouseEventTool()); } else { bar = (NBarSeries)(NThinChartControl1.Charts[0].Series[0]); } bar.InteractivityStyles.Clear(); for (int i = 0; i < bar.Values.Count; i++) { NInteractivityStyle interactivityStyle = new NInteractivityStyle(); string script = "alert(\"Mouse Event [" + CaptureMouseEventDropDownList.SelectedValue.ToString() + "]. Captured for bar [" + i.ToString() + "])\");"; switch (CaptureMouseEventDropDownList.SelectedIndex) { case 0: // OnClick interactivityStyle.ClientMouseEventAttribute.Click = script; break; case 1: // OnDblClick interactivityStyle.ClientMouseEventAttribute.DoubleClick = script; break; case 2: // OnMouseEnter interactivityStyle.ClientMouseEventAttribute.MouseEnter = script; break; case 3: // OnMouseLeave interactivityStyle.ClientMouseEventAttribute.MouseLeave = script; break; case 4: interactivityStyle.ClientMouseEventAttribute.Click = "_doPostback()"; break; } bar.InteractivityStyles[i] = interactivityStyle; } }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { nChartControl1.Panels.Clear(); // set a chart title NLabel title = new NLabel("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, System.Drawing.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); float angleStep = 180.0f / (radarChart.Axes.Count - 1); for (int i = 0; i < radarChart.Axes.Count; i++) { NRadarAxis radarAxis = (NRadarAxis)radarChart.Axes[i]; ((NRadarAxisAnchor)radarAxis.Anchor).UseCustomAngle = true; ((NRadarAxisAnchor)radarAxis.Anchor).CustomAngle = i * angleStep; } // 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); //radarLine.CloseContour = false; } // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); }
protected void Page_Load(object sender, EventArgs e) { if (!NThinChartControl1.Initialized) { // enable jittering (full scene antialiasing) NThinChartControl1.Settings.JitterMode = JitterMode.Enabled; NThinChartControl1.Panels.Clear(); // apply background image border NImageFrameStyle frame = new NImageFrameStyle(); frame.Type = ImageFrameType.Raised; frame.BackgroundColor = Color.White; frame.BorderStyle.Color = Color.Gainsboro; NThinChartControl1.BackgroundStyle.FrameStyle = frame; NThinChartControl1.BackgroundStyle.FillStyle = new NGradientFillStyle(Color.White, Color.GhostWhite); // set a chart title NLabel title = new NLabel("Postback Tool"); NThinChartControl1.Panels.Add(title); title.DockMode = PanelDockMode.Top; title.Padding = new NMarginsL(4, 6, 4, 6); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // configure the legend NLegend legend = new NLegend(); NThinChartControl1.Panels.Add(legend); legend.DockMode = PanelDockMode.Right; legend.Padding = new NMarginsL(1, 1, 3, 3); legend.FillStyle.SetTransparencyPercent(50); 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.HorizontalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.VerticalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); // configure the chart NCartesianChart chart = new NCartesianChart(); NThinChartControl1.Panels.Add(chart); chart.Enable3D = true; chart.Fit3DAxisContent = true; chart.DisplayOnLegend = legend; chart.BoundsMode = BoundsMode.Fit; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); chart.DockMode = PanelDockMode.Fill; chart.Padding = new NMarginsL( new NLength(3, NRelativeUnit.ParentPercentage), new NLength(3, NRelativeUnit.ParentPercentage), new NLength(3, NRelativeUnit.ParentPercentage), new NLength(3, NRelativeUnit.ParentPercentage)); // setup the X axis NAxis axisX = chart.Axis(StandardAxis.PrimaryX); NOrdinalScaleConfigurator scaleX = (NOrdinalScaleConfigurator)axisX.ScaleConfigurator; scaleX.MajorTickMode = MajorTickMode.AutoMaxCount; // add interlaced stripe for the Y axis NAxis axisY = chart.Axis(StandardAxis.PrimaryY); NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)axisY.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); // hide the depth axis chart.Axis(StandardAxis.Depth).Visible = false; // add a bar series and fill it with data NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.Name = "Simple Bar Chart"; bar.BarShape = BarShape.SmoothEdgeBar; bar.Legend.Mode = SeriesLegendMode.DataPoints; bar.Legend.TextStyle.FontStyle.EmSize = new NLength(8, NGraphicsUnit.Point); bar.DataLabelStyle.Visible = false; bar.AddDataPoint(new NDataPoint(16, "Spain")); bar.AddDataPoint(new NDataPoint(42, "France")); bar.AddDataPoint(new NDataPoint(56, "Germany")); bar.AddDataPoint(new NDataPoint(23, "Italy")); bar.AddDataPoint(new NDataPoint(47, "UK")); bar.AddDataPoint(new NDataPoint(38, "Sweden")); for (int i = 0; i < bar.Values.Count; i++) { bar.InteractivityStyles[i] = new NInteractivityStyle("Click on bar to make it red"); } // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(bar); NThinChartControl1.Controller.Tools.Add(new NPostbackTool()); } NThinChartControl1.Postback += new NPostbackEventHandler(NThinChartControl1_Postback); NThinChartControl1.Controller.Tools.Clear(); NTooltipTool tooltipTool = new NTooltipTool(); NThinChartControl1.Controller.Tools.Add(tooltipTool); NPostbackTool postbackTool = new NPostbackTool(); postbackTool.PostbackOnlyOnInteractiveItems = PostbackOnlyOnInteractiveItemsCheckBox.Checked; NThinChartControl1.Controller.Tools.Add(postbackTool); }
protected void Page_Load(object sender, System.EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Funnel 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)); NLegend legend = nChartControl1.Legends[0]; legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Bottom); legend.Data.ExpandMode = LegendExpandMode.RowsFixed; legend.Data.RowCount = 2; NFunnelChart chart = new NFunnelChart(); chart.BoundsMode = BoundsMode.Fit; chart.Location = new NPointL( new NLength(10, NRelativeUnit.ParentPercentage), new NLength(12, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL( new NLength(80, NRelativeUnit.ParentPercentage), new NLength(68, NRelativeUnit.ParentPercentage)); nChartControl1.Charts.Clear(); nChartControl1.Charts.Add(chart); NFunnelSeries funnel = (NFunnelSeries)chart.Series.Add(SeriesType.Funnel); funnel.BorderStyle.Color = Color.LemonChiffon; funnel.Legend.DisplayOnLegend = legend; funnel.Legend.Format = "<percent>"; funnel.Legend.Mode = SeriesLegendMode.DataPoints; funnel.DataLabelStyle.Format = "<value> [<xsize>]"; funnel.UseXSizes = true; funnel.Values.ValueFormatter = new NNumericValueFormatter("0.00"); funnel.XSizes.ValueFormatter = new NNumericValueFormatter("0.00"); GenerateData(funnel); if (!IsPostBack) { // init form controls WebExamplesUtilities.FillComboWithEnumValues(FunnelLabelModeDropDownList, typeof(FunnelLabelMode)); FunnelLabelModeDropDownList.SelectedIndex = (int)FunnelLabelMode.RightAligned; WebExamplesUtilities.FillComboWithValues(FunnelPointGapDropDownList, 0, 15, 1); FunnelPointGapDropDownList.SelectedIndex = 6; WebExamplesUtilities.FillComboWithValues(FunnelRadiusDropDownList, 0, 100, 10); FunnelRadiusDropDownList.SelectedIndex = (int)(chart.Width / 10.0f); WebExamplesUtilities.FillComboWithValues(FunnelArrowLengthDropDownList, 0, 10, 1); FunnelArrowLengthDropDownList.SelectedIndex = 1; } // init funnel label mode funnel.LabelMode = (FunnelLabelMode)FunnelLabelModeDropDownList.SelectedIndex; HorzAlign ha = HorzAlign.Center; switch (funnel.LabelMode) { case FunnelLabelMode.Left: case FunnelLabelMode.LeftAligned: ha = HorzAlign.Right; break; case FunnelLabelMode.Right: case FunnelLabelMode.RightAligned: ha = HorzAlign.Left; break; } funnel.DataLabelStyle.TextStyle.StringFormatStyle.HorzAlign = ha; // arrow length funnel.DataLabelStyle.ArrowLength = new NLength((float)FunnelArrowLengthDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage); // funnel radius chart.Width = FunnelRadiusDropDownList.SelectedIndex * 10; funnel.FunnelPointGap = FunnelPointGapDropDownList.SelectedIndex / 10.0f; }
protected void Page_Load(object sender, EventArgs e) { nFunction = new NFunctionCalculator(); if (!IsPostBack) { FunctionDropDownList.Items.Add("Simple Moving Average"); FunctionDropDownList.Items.Add("Weighted Moving Average"); FunctionDropDownList.Items.Add("Exponential Moving Average"); FunctionDropDownList.Items.Add("Modified Moving Average"); FunctionDropDownList.SelectedIndex = 0; // form controls ApplyFunctionToDropDownList.Items.Add("Open"); ApplyFunctionToDropDownList.Items.Add("High"); ApplyFunctionToDropDownList.Items.Add("Low"); ApplyFunctionToDropDownList.Items.Add("Close"); ApplyFunctionToDropDownList.SelectedIndex = 3; WebExamplesUtilities.FillComboWithFloatValues(PeriodDropDownList, 0, 50, 1); PeriodDropDownList.SelectedIndex = 10; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // add header NLabel header = nChartControl1.Labels.AddHeader("Moving Averages"); 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)); NLegend legend = nChartControl1.Legends[0]; legend.Location = new NPointL( new NLength(98, NRelativeUnit.ParentPercentage), new NLength(12, NRelativeUnit.ParentPercentage)); NChart chart = nChartControl1.Charts[0]; chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); chart.LightModel.EnableLighting = false; chart.Axis(StandardAxis.Depth).Visible = false; chart.Wall(ChartWallType.Floor).Visible = false; chart.Wall(ChartWallType.Left).Visible = false; chart.BoundsMode = BoundsMode.Stretch; chart.Location = new NPointL( new NLength(5, NRelativeUnit.ParentPercentage), new NLength(20, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL( new NLength(90, NRelativeUnit.ParentPercentage), new NLength(75, NRelativeUnit.ParentPercentage)); // align the chart and the legend NSideGuideline guideline = new NSideGuideline(PanelSide.Right); guideline.Targets.Add(legend); guideline.Targets.Add(chart); nChartControl1.Document.RootPanel.Guidelines.Add(guideline); // 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 chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // setup primary Y axis NAxis axis = chart.Axis(StandardAxis.PrimaryY); NLinearScaleConfigurator linearScaleConfigurator = (NLinearScaleConfigurator)axis.ScaleConfigurator; linearScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Left, false); linearScaleConfigurator.InnerMajorTickStyle.LineStyle.Width = new NLength(0, NGraphicsUnit.Pixel); // line series for the function NLineSeries line = (NLineSeries)chart.Series.Add(SeriesType.Line); line.DataLabelStyle.Visible = false; line.BorderStyle.Color = Color.Red; line.BorderStyle.Width = new NLength(2, NGraphicsUnit.Pixel); line.UseXValues = true; Color customColor = Color.FromArgb(100, 100, 150); // setup the stock series NStockSeries stock = (NStockSeries)chart.Series.Add(SeriesType.Stock); stock.DataLabelStyle.Visible = false; stock.CandleStyle = CandleStyle.Bar; stock.CandleWidth = new NLength(1, NRelativeUnit.ParentPercentage); stock.HighLowStrokeStyle.Color = customColor; stock.UpStrokeStyle.Color = customColor; stock.DownStrokeStyle.Color = customColor; stock.UpFillStyle = new NColorFillStyle(Color.White); stock.DownFillStyle = new NColorFillStyle(customColor); stock.Legend.Mode = SeriesLegendMode.None; stock.OpenValues.Name = "open"; stock.HighValues.Name = "high"; stock.LowValues.Name = "low"; stock.CloseValues.Name = "close"; stock.UseXValues = true; stock.InflateMargins = true; GenerateData(stock); BuildExpression(stock, line); line.XValues = (NDataSeriesDouble)stock.XValues.Clone(); line.Values = nFunction.Calculate(); }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Panels.Clear(); if (!IsPostBack) { // init form controls ShowLevelSeparatorsCheckBox.Checked = true; Show2007DataCheckBox.Checked = true; } // set a chart title NLabel header = new NLabel("Quarterly Company Sales<br/><font size = '9pt'>Demonstrates how to use hierarchical scale configurators</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, 10, 10); nChartControl1.Panels.Add(header); NCartesianChart chart = new NCartesianChart(); nChartControl1.Panels.Add(chart); NLegend legend = new NLegend(); legend.Margins = new NMarginsL(10, 0, 10, 0); legend.DockMode = PanelDockMode.Right; legend.FitAlignment = ContentAlignment.TopCenter; legend.Data.ExpandMode = LegendExpandMode.ColsOnly; legend.FillStyle = new NColorFillStyle(Color.FromArgb(125, Color.White)); legend.HorizontalBorderStyle.Width = new NLength(0); legend.VerticalBorderStyle.Width = new NLength(0); legend.OuterTopBorderStyle.Width = new NLength(0); legend.OuterLeftBorderStyle.Width = new NLength(0); legend.OuterBottomBorderStyle.Width = new NLength(0); legend.OuterRightBorderStyle.Width = new NLength(0); chart.ChildPanels.Add(legend); NRangeSelection rangeSelection = new NRangeSelection(); rangeSelection.VerticalValueSnapper = new NAxisRulerMinMaxSnapper(); chart.RangeSelections.Add(rangeSelection); chart.DisplayOnLegend = legend; chart.DockMode = PanelDockMode.Fill; chart.BoundsMode = BoundsMode.Stretch; chart.Margins = new NMarginsL(5, 0, 5, 10); chart.Axis(StandardAxis.Depth).Visible = false; // first determine how many months we will show int monthCount = 12; if (Show2007DataCheckBox.Checked) { monthCount += 12; } // add the first bar NBarSeries bar1 = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar1.Name = "Coca Cola"; bar1.MultiBarMode = MultiBarMode.Series; bar1.DataLabelStyle.Visible = false; bar1.Values.FillRandomRange(Random, monthCount, 10, 200); // add the second bar NBarSeries bar2 = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar2.Name = "Pepsi"; bar2.MultiBarMode = MultiBarMode.Clustered; bar2.DataLabelStyle.Visible = false; // fill with random data bar2.Values.FillRandomRange(Random, monthCount, 10, 300); NAxis xAxis = chart.Axis(StandardAxis.PrimaryX); xAxis.ScrollBar.Visible = true; // add custom labels to the Y axis NLinearScaleConfigurator linearScale = chart.Axis(StandardAxis.PrimaryY).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); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); UpdateScale(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithValues(PeriodDropDownList, 0, 100, 10); PeriodDropDownList.SelectedIndex = 2; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; NFunctionCalculator calc = new NFunctionCalculator(); nChartControl1.Settings.ShapeRenderingMode = ShapeRenderingMode.None; NChart chart = nChartControl1.Charts[0]; chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); chart.BoundsMode = BoundsMode.Stretch; chart.Location = new NPointL( new NLength(5, NRelativeUnit.ParentPercentage), new NLength(20, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL( new NLength(90, NRelativeUnit.ParentPercentage), new NLength(75, NRelativeUnit.ParentPercentage)); NLegend legend = nChartControl1.Legends[0]; legend.Data.ExpandMode = LegendExpandMode.ColsOnly; legend.Location = new NPointL( new NLength(98, NRelativeUnit.ParentPercentage), new NLength(12, NRelativeUnit.ParentPercentage)); // align the chart and the legend NSideGuideline guideline = new NSideGuideline(PanelSide.Right); guideline.Targets.Add(legend); guideline.Targets.Add(chart); nChartControl1.Document.RootPanel.Guidelines.Add(guideline); // setup X axis NValueTimelineScaleConfigurator scaleX = new NValueTimelineScaleConfigurator(); 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.FirstRow.InnerTickStyle.Visible = false; 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.SecondRow.InnerTickStyle.Visible = false; scaleX.ThirdRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.ThirdRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(205, 205, 205)); scaleX.ThirdRow.UseGridStyle = true; scaleX.ThirdRow.InnerTickStyle.Visible = false; // calendar NWeekDayRule wdr = new NWeekDayRule(WeekDayBit.All); wdr.Saturday = false; wdr.Sunday = false; scaleX.Calendar.Rules.Add(wdr); scaleX.EnableCalendar = true; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // setup primary Y axis NAxis axisY1 = chart.Axis(StandardAxis.PrimaryY); axisY1.Anchor = new NDockAxisAnchor(AxisDockZone.FrontLeft, false, 45, 100); NLinearScaleConfigurator scaleY1 = (NLinearScaleConfigurator)axisY1.ScaleConfigurator; scaleY1.RulerStyle.Height = new NLength(2, NGraphicsUnit.Pixel); scaleY1.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleY1.InnerMajorTickStyle.LineStyle.Width = new NLength(0); // setup secondary Y axis NAxis axisY2 = chart.Axis(StandardAxis.SecondaryY); axisY2.Visible = true; axisY2.Anchor = new NDockAxisAnchor(AxisDockZone.FrontLeft, false, 0, 40); NLinearScaleConfigurator scaleY2 = (NLinearScaleConfigurator)axisY2.ScaleConfigurator; scaleY2.RulerStyle.Height = new NLength(2, NGraphicsUnit.Pixel); scaleY2.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleY2.InnerMajorTickStyle.LineStyle.Width = new NLength(0); Color color1 = Color.FromArgb(100, 100, 150); Color color2 = Color.FromArgb(200, 120, 120); Color color3 = Color.FromArgb(100, 150, 100); // setup the stock series NStockSeries stock = (NStockSeries)chart.Series.Add(SeriesType.Stock); stock.DataLabelStyle.Visible = false; stock.CandleStyle = CandleStyle.Stick; stock.UpStrokeStyle.Color = color1; stock.DownStrokeStyle.Color = color2; stock.Legend.Mode = SeriesLegendMode.None; stock.CandleWidth = new NLength(0.5f, NRelativeUnit.ParentPercentage); stock.UseXValues = true; stock.InflateMargins = true; // Add line series for ADX NLineSeries lineADX = (NLineSeries)chart.Series.Add(SeriesType.Line); lineADX.DisplayOnAxis(StandardAxis.PrimaryY, false); lineADX.DisplayOnAxis(StandardAxis.SecondaryY, true); lineADX.BorderStyle.Color = Color.LimeGreen; lineADX.Name = "ADX"; lineADX.DataLabelStyle.Visible = false; // Add line series for +DI NLineSeries lineDIPos = (NLineSeries)chart.Series.Add(SeriesType.Line); lineDIPos.MultiLineMode = MultiLineMode.Overlapped; lineDIPos.DisplayOnAxis(StandardAxis.PrimaryY, false); lineDIPos.DisplayOnAxis(StandardAxis.SecondaryY, true); lineDIPos.BorderStyle.Color = Color.Red; lineDIPos.Name = "+DI"; lineDIPos.DataLabelStyle.Visible = false; // Add line series for -DI NLineSeries lineDINeg = (NLineSeries)chart.Series.Add(SeriesType.Line); lineDINeg.MultiLineMode = MultiLineMode.Overlapped; lineDINeg.DisplayOnAxis(StandardAxis.PrimaryY, false); lineDINeg.DisplayOnAxis(StandardAxis.SecondaryY, true); lineDINeg.BorderStyle.Color = Color.Blue; lineDINeg.Name = "-DI"; lineDINeg.DataLabelStyle.Visible = false; // add arguments for function calculator stock.CloseValues.Name = "close"; stock.HighValues.Name = "high"; stock.LowValues.Name = "low"; calc.Arguments.Add(stock.CloseValues); calc.Arguments.Add(stock.HighValues); calc.Arguments.Add(stock.LowValues); // form controls lineDIPos.Visible = ShowPosDICheckBox.Checked; lineDINeg.Visible = ShowNegDICheckBox.Checked; lineADX.Visible = ShowADXCheckBox.Checked; // add header NLabel header = nChartControl1.Labels.AddHeader("Directional Movement"); 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)); GenerateData(stock); UpdateFunctions(stock, lineDIPos, lineDINeg, lineADX, calc); }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // add header NLabel header = nChartControl1.Labels.AddHeader("Sum of Data Points"); 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)); // setup legend NLegend legend = nChartControl1.Legends[0]; legend.Location = new NPointL(legend.Location.X, new NLength(15, NRelativeUnit.ParentPercentage)); legend.Data.MarkSize = new NSizeL(5, 5); nChart = nChartControl1.Charts[0]; nChart.Enable3D = true; nFuncCalculator = new NFunctionCalculator(); if (!IsPostBack) { // form controls GroupingDropDownList.Items.Add("Do not group"); GroupingDropDownList.Items.Add("Group by every 2 values"); GroupingDropDownList.Items.Add("Group by every 3 values"); GroupingDropDownList.Items.Add("Group by every 4 values"); GroupingDropDownList.SelectedIndex = 0; DataDropDownList.Items.Add("Positive"); DataDropDownList.Items.Add("Positive and Negative"); DataDropDownList.SelectedIndex = 0; } // setup chart nChart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); nChart.LightModel.SetPredefinedLightModel(PredefinedLightModel.MetallicLustre); nChart.BoundsMode = BoundsMode.Stretch; nChart.Location = new NPointL( new NLength(10, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); nChart.Size = new NSizeL( new NLength(70, NRelativeUnit.ParentPercentage), new NLength(75, NRelativeUnit.ParentPercentage)); nChart.Axis(StandardAxis.Depth).Visible = false; nChart.Wall(ChartWallType.Left).Visible = false; nChart.Wall(ChartWallType.Floor).Visible = false; // setup X axis NOrdinalScaleConfigurator ordinalScale = (NOrdinalScaleConfigurator)nChart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; ordinalScale.DisplayDataPointsBetweenTicks = false; // add a line series for the function nLine = (NLineSeries)nChart.Series.Add(SeriesType.Line); nLine.MarkerStyle.Visible = true; nLine.MarkerStyle.BorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); nLine.MarkerStyle.FillStyle = new NColorFillStyle(Color.Crimson); nLine.BorderStyle.Color = Color.Red; nLine.BorderStyle.Width = new NLength(2, NGraphicsUnit.Pixel); nLine.Values.ValueFormatter = new NNumericValueFormatter("0.00"); nLine.DisplayOnAxis(StandardAxis.PrimaryX, false); nLine.DisplayOnAxis(StandardAxis.SecondaryX, true); nLine.Legend.Mode = SeriesLegendMode.None; nLine.Legend.TextStyle = new NTextStyle(new NFontStyle("Arial", 7)); // add the bar series nBar = (NBarSeries)nChart.Series.Add(SeriesType.Bar); nBar.Name = "Bar1"; nBar.Values.Name = "values"; nBar.Values.ValueFormatter = new NNumericValueFormatter("0.00"); nBar.MultiBarMode = MultiBarMode.Series; nBar.DataLabelStyle.Visible = false; nBar.Legend.Mode = SeriesLegendMode.DataPoints; nBar.BarShape = BarShape.SmoothEdgeBar; nBar.BorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); nBar.FillStyle = new NColorFillStyle(Color.Orange); nBar.Legend.TextStyle = new NTextStyle(new NFontStyle("Arial", 7)); if (DataDropDownList.SelectedIndex == 0) { nBar.Values.FillRandomRange(Random, 12, 0, 50); } else { nBar.Values.FillRandomRange(Random, 12, -25, 25); } // set the function argument nFuncCalculator.Arguments.Add(nBar.Values); CalcFunction(); }