private void ConfigureChart(NChart chart, Color color) { chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); chart.Axis(StandardAxis.Depth).Visible = false; chart.Wall(ChartWallType.Floor).Visible = false; chart.Wall(ChartWallType.Left).Visible = false; chart.Wall(ChartWallType.Back).Width = 0; chart.Wall(ChartWallType.Back).FillStyle = new NColorFillStyle(Color.FromArgb(239, 245, 239)); chart.Wall(ChartWallType.Back).ShadowStyle.Type = ShadowType.Solid; // create a bar series NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.Name = "Bar 1"; bar.Legend.Mode = SeriesLegendMode.DataPoints; bar.DataLabelStyle.Visible = false; bar.InflateMargins = true; bar.FillStyle = new NColorFillStyle(color); bar.Values.ValueFormatter = new NNumericValueFormatter("0.00"); for (int i = 0; i < 15; i++) { bar.Values.Add(Random.NextDouble() * 900); } }
public override void Initialize() { base.Initialize(); nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); nChartControl1.Legends.Clear(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Chart Walls"); 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(3, NRelativeUnit.ParentPercentage)); m_Chart = nChartControl1.Charts[0]; m_Chart.Enable3D = true; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); m_Chart.Axis(StandardAxis.Depth).Visible = false; // add interlaced stripe to the Y axis NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); stripStyle.Interlaced = true; ((NStandardScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator).StripStyles.Add(stripStyle); NBarSeries bar = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar); bar.Values.FillRandom(Random, 6); bar.Name = "Bars"; bar.DataLabelStyle.Visible = false; // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); // init form controls LeftVisibleCheck.Checked = m_Chart.Wall(ChartWallType.Left).Visible; BackVisibleCheck.Checked = m_Chart.Wall(ChartWallType.Back).Visible; RightVisibleCheck.Checked = m_Chart.Wall(ChartWallType.Right).Visible; FloorVisibleCheck.Checked = m_Chart.Wall(ChartWallType.Floor).Visible; LeftWidthScroll.Value = 20; BackWidthScroll.Value = 20; RightWidthScroll.Value = 20; FloorWidthScroll.Value = 20; }
public override void Initialize() { base.Initialize(); nChartControl1.BackgroundStyle.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant2, Color.White, Color.FromArgb(230, 230, 244)); // add label NLabel title = nChartControl1.Labels.AddHeader("Advanced Gradient Fill Style"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // setup chart and axes m_Chart = nChartControl1.Charts[0]; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.SoftTopLeft); m_Chart.Axis(StandardAxis.Depth).Visible = false; NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.LineStyle.Color = Color.White; linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.LineStyle.Color = Color.White; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); // set walls advanced gradient NAdvancedGradientFillStyle ag = AzureLight(); m_Chart.Wall(ChartWallType.Back).FillStyle = ag; m_Chart.Wall(ChartWallType.Left).FillStyle = ag; m_Chart.Wall(ChartWallType.Floor).FillStyle = ag; // create bubble chart m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); m_Bubble.DataLabelStyle.Visible = false; m_Bubble.Legend.Mode = SeriesLegendMode.DataPoints; m_Bubble.BubbleShape = PointShape.Sphere; m_Bubble.BorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); m_Bubble.UseXValues = true; m_Bubble.InflateMargins = true; m_Bubble.FillStyle = TheEye(); GenerateData(); }
private void ChooseImageWalls_Click(object sender, System.EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { NImageFillStyle imageFillStyle = new NImageFillStyle(openFileDialog1.FileName); m_Chart.Wall(ChartWallType.Back).FillStyle = imageFillStyle; m_Chart.Wall(ChartWallType.Left).FillStyle = imageFillStyle; m_Chart.Wall(ChartWallType.Floor).FillStyle = imageFillStyle; nChartControl1.Refresh(); } }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Bevel and Emboss Filter"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // no legend nChartControl1.Legends.Clear(); // configure chart NChart chart = nChartControl1.Charts[0]; chart.Axis(StandardAxis.Depth).Visible = false; chart.Wall(ChartWallType.Back).Visible = false; // add bar and change bar color NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.Name = "Bar Series"; bar.FillStyle = new NGradientFillStyle(GradientStyle.Vertical, GradientVariant.Variant2, Color.DarkRed, Color.Red); bar.BorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); bar.DataLabelStyle.Visible = false; bar.Values.Add(18); bar.Values.Add(15); bar.Values.Add(21); bar.Values.Add(23); bar.Values.Add(28); bar.Values.Add(29); NBevelAndEmbossImageFilter bevelAndEmbossImageFilter = new NBevelAndEmbossImageFilter(); bevelAndEmbossImageFilter.BlurType = BlurType.Gaussian; bar.FillStyle.ImageFiltersStyle.Filters.Add(bevelAndEmbossImageFilter); // init form controls m_bUpdating = true; BevelTypeComboBox.FillFromEnum(typeof(BevelType)); BlurTypeComboBox.FillFromEnum(typeof(BlurType)); BarStyleComboBox.FillFromEnum(typeof(BarShape)); BarStyleComboBox.SelectedIndex = 0; BevelTypeComboBox.SelectedIndex = (int)bevelAndEmbossImageFilter.BevelType; AngleNumericUpDown.Value = (decimal)bevelAndEmbossImageFilter.Angle; DepthNumericUpDown.Value = (decimal)bevelAndEmbossImageFilter.Depth.Value; SoftenNumericUpDown.Value = (decimal)bevelAndEmbossImageFilter.Soften.Value; BlurTypeComboBox.SelectedIndex = (int)bevelAndEmbossImageFilter.BlurType; OriginalOpacityNumericUpDown.Value = (decimal)bevelAndEmbossImageFilter.OriginalOpacity; m_bUpdating = false; }
private void ModifyAppearanceButton_Click(object sender, System.EventArgs e) { m_Chart.Wall(ChartWallType.Back).FillStyle = new NColorFillStyle(RandomColor()); // create a line series for the simple moving average m_LineSMA.BorderStyle.Color = RandomColor(); m_Stock.DownFillStyle = new NColorFillStyle(RandomColor()); m_Stock.UpFillStyle = new NColorFillStyle(RandomColor()); m_Stock.UpStrokeStyle.Color = RandomColor(); m_Stock.DownStrokeStyle.Color = RandomColor(); // add the bollinger bands as high low area m_HighLow.HighFillStyle = new NColorFillStyle(RandomColor()); nChartControl1.Refresh(); }
private void AutoWallVisibilityCheck_CheckedChanged(object sender, EventArgs e) { NChart chart = nChartControl1.Charts[0]; if (AutoWallVisibilityCheck.Checked) { foreach (NChartWall wall in chart.Walls) { wall.VisibilityMode = WallVisibilityMode.Auto; } } else { chart.Wall(ChartWallType.Left).VisibilityMode = WallVisibilityMode.Visible; chart.Wall(ChartWallType.Back).VisibilityMode = WallVisibilityMode.Visible; chart.Wall(ChartWallType.Floor).VisibilityMode = WallVisibilityMode.Visible; chart.Wall(ChartWallType.Front).VisibilityMode = WallVisibilityMode.Hidden; chart.Wall(ChartWallType.Top).VisibilityMode = WallVisibilityMode.Hidden; chart.Wall(ChartWallType.Right).VisibilityMode = WallVisibilityMode.Hidden; } nChartControl1.Refresh(); }
public override void Initialize() { base.Initialize(); nChartControl1.BackgroundStyle.FillStyle = new NColorFillStyle(Color.FromArgb(230, 230, 255)); // add label NLabel title = nChartControl1.Labels.AddHeader("Colors And Materials"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // setup chart m_Chart = nChartControl1.Charts[0]; m_Chart.Enable3D = true; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective); // Setup the light model m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.NorthernLights); m_Chart.LightModel.GlobalAmbientLight = Color.FromArgb(64, 64, 64); m_Chart.LightModel.LightSources[0].Diffuse = Color.FromArgb(160, 160, 160); m_Chart.LightModel.LightSources[1].Diffuse = Color.FromArgb(160, 160, 160); m_Chart.LightModel.LightSources[2].Diffuse = Color.FromArgb(160, 160, 160); // Setup axes m_Chart.Axis(StandardAxis.Depth).Visible = false; NStandardScaleConfigurator standardScale = (NStandardScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; standardScale.MajorGridStyle.LineStyle.Color = Color.White; standardScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; standardScale = (NStandardScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; standardScale.MajorGridStyle.LineStyle.Color = Color.White; standardScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; standardScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); // Setup walls Color diffuse = Color.FromArgb(128, 128, 192); m_Chart.Wall(ChartWallType.Back).FillStyle.MaterialStyle.Diffuse = diffuse; m_Chart.Wall(ChartWallType.Left).FillStyle.MaterialStyle.Diffuse = diffuse; m_Chart.Wall(ChartWallType.Floor).FillStyle.MaterialStyle.Diffuse = diffuse; Color ambient = Color.FromArgb(128, 0, 255); m_Chart.Wall(ChartWallType.Back).FillStyle.MaterialStyle.Ambient = ambient; m_Chart.Wall(ChartWallType.Left).FillStyle.MaterialStyle.Ambient = ambient; m_Chart.Wall(ChartWallType.Floor).FillStyle.MaterialStyle.Ambient = ambient; m_Chart.Wall(ChartWallType.Back).FillStyle.MaterialStyle.Specular = Color.White; m_Chart.Wall(ChartWallType.Left).FillStyle.MaterialStyle.Specular = Color.White; m_Chart.Wall(ChartWallType.Floor).FillStyle.MaterialStyle.Specular = Color.White; m_Chart.Wall(ChartWallType.Back).FillStyle.MaterialStyle.Shininess = 110; m_Chart.Wall(ChartWallType.Left).FillStyle.MaterialStyle.Shininess = 110; m_Chart.Wall(ChartWallType.Floor).FillStyle.MaterialStyle.Shininess = 110; // Create a bar series m_Bar = (NFloatBarSeries)m_Chart.Series.Add(SeriesType.FloatBar); m_Bar.DataLabelStyle.Visible = false; m_Bar.BarShape = BarShape.SmoothEdgeBar; m_Bar.BarEdgePercent = 50; m_Bar.WidthPercent = 60; m_Bar.DepthPercent = 60; m_Bar.Legend.Mode = SeriesLegendMode.DataPoints; m_Bar.FillStyle.MaterialStyle.Diffuse = Color.FromArgb(0, 0, 64); m_Bar.FillStyle.MaterialStyle.Ambient = Color.White; m_Bar.FillStyle.MaterialStyle.Specular = Color.White; m_Bar.BorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel);; m_Bar.AddDataPoint(new NFloatBarDataPoint(2.0, 24.0)); m_Bar.AddDataPoint(new NFloatBarDataPoint(21.0, 60.0)); m_Bar.AddDataPoint(new NFloatBarDataPoint(22.0, 53.0)); m_Bar.AddDataPoint(new NFloatBarDataPoint(34.0, 80.0)); m_Bar.AddDataPoint(new NFloatBarDataPoint(11.0, 62.0)); // init form controls m_bSkipUpdate = true; BarsShininessSpin.Value = (decimal)m_Bar.FillStyle.MaterialStyle.Shininess; WallsShininessSpin.Value = (decimal)m_Chart.Wall(ChartWallType.Back).FillStyle.MaterialStyle.Shininess; m_bSkipUpdate = false; }
protected void Page_Load(object sender, System.EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel header = nChartControl1.Labels.AddFooter("Price Indicators"); 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 chart 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.Height = 40; chart.Location = new NPointL( new NLength(5, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL( new NLength(90, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage)); // setup X axis NRangeTimelineScaleConfigurator scaleX = new NRangeTimelineScaleConfigurator(); scaleX.FirstRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.FirstRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(225, 225, 225)); scaleX.FirstRow.UseGridStyle = true; scaleX.SecondRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.SecondRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(215, 215, 215)); scaleX.SecondRow.UseGridStyle = true; scaleX.ThirdRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.ThirdRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(205, 205, 205)); scaleX.ThirdRow.UseGridStyle = true; // calendar NWeekDayRule wdr = new NWeekDayRule(WeekDayBit.All); wdr.Saturday = false; wdr.Sunday = false; scaleX.Calendar.Rules.Add(wdr); scaleX.EnableCalendar = true; // set configurator chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // setup Y axis NAxis axis = chart.Axis(StandardAxis.PrimaryY); NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)axis.ScaleConfigurator; linearScale.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; linearScale.InnerMajorTickStyle.Length = new NLength(0); // line series for the function 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.ShadowStyle.Type = ShadowType.GaussianBlur; 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.Stick; 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.CandleWidth = new NLength(1, NRelativeUnit.ParentPercentage); stock.InflateMargins = true; stock.UseXValues = true; GenerateData(stock); if (!IsPostBack) { FunctionDropDownList.Items.Add("Median Price"); FunctionDropDownList.Items.Add("Typical Price"); FunctionDropDownList.Items.Add("Weighted Close"); FunctionDropDownList.SelectedIndex = 0; } CalculateFunction(stock, line); }
public override void Initialize() { base.Initialize(); nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Jittering / Blur Effect"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); m_Chart = nChartControl1.Charts[0]; m_Chart.Enable3D = true; m_Chart.Axis(StandardAxis.Depth).Visible = false; m_Chart.Depth = 34; m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.NorthernLights); m_Chart.Projection.Type = ProjectionType.Perspective; m_Chart.Projection.Elevation = 17; m_Chart.Projection.Rotation = -10; Color c = Color.FromArgb(128, 128, 192); m_Chart.Wall(ChartWallType.Left).FillStyle = new NGradientFillStyle(GradientStyle.DiagonalDown, GradientVariant.Variant3, c, Color.White); m_Chart.Wall(ChartWallType.Floor).FillStyle = new NGradientFillStyle(GradientStyle.DiagonalUp, GradientVariant.Variant3, c, Color.White); m_Chart.Wall(ChartWallType.Back).FillStyle = new NGradientFillStyle(GradientStyle.DiagonalDown, GradientVariant.Variant3, c, Color.White); NBubbleSeries bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); bubble.InflateMargins = false; bubble.DataLabelStyle.Visible = false; bubble.Legend.Mode = SeriesLegendMode.DataPoints; bubble.BubbleShape = PointShape.Sphere; bubble.AddDataPoint(new NBubbleDataPoint(10, 10, "B1", new NColorFillStyle(Color.DarkGoldenrod))); bubble.AddDataPoint(new NBubbleDataPoint(15, 20, "B2", new NColorFillStyle(Color.IndianRed))); bubble.AddDataPoint(new NBubbleDataPoint(12, 25, "B3", new NColorFillStyle(Color.DarkMagenta))); bubble.AddDataPoint(new NBubbleDataPoint(8, 15, "B4", new NColorFillStyle(Color.DarkOrchid))); NBarSeries bar = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar); bar.Name = "Stack 1"; bar.DataLabelStyle.Visible = false; bar.BarShape = BarShape.Cylinder; bar.WidthPercent = 60; bar.DepthPercent = 60; bar.BorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); bar.FillStyle = new NColorFillStyle(Color.CornflowerBlue); bar.Values.FillRandomRange(Random, 4, 5, 15); bar = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar); bar.MultiBarMode = MultiBarMode.Stacked; bar.Name = "Stack 2"; bar.DataLabelStyle.Visible = false; bar.BarShape = BarShape.Cylinder; bar.WidthPercent = 60; bar.DepthPercent = 60; bar.BorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); bar.FillStyle = new NColorFillStyle(Color.Yellow); bar.Values.FillRandomRange(Random, 4, 5, 15); bar = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar); bar.MultiBarMode = MultiBarMode.Stacked; bar.Name = "Stack 3"; bar.DataLabelStyle.Visible = false; bar.BarShape = BarShape.Cylinder; bar.WidthPercent = 60; bar.DepthPercent = 60; bar.BorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); bar.FillStyle = new NColorFillStyle(Color.MediumSeaGreen); bar.Values.FillRandomRange(Random, 4, 5, 15); // init form controls for (int i = 2; i < 17; i++) { JitteringStepsComboBox.Items.Add(i.ToString()); } JitteringStepsComboBox.SelectedIndex = nChartControl1.Settings.JitteringSteps - 2; JitteringDeviationUpDown.Value = (decimal)nChartControl1.Settings.JitteringDeviation; JitteringStepsComboBox.Enabled = false; JitteringDeviationUpDown.Enabled = false; EnableJitteringCheckBox.Checked = false; }
private void StyleComboWalls_SelectedIndexChanged(object sender, System.EventArgs e) { if (m_bSkipUpdate) { return; } NGradientFillStyle gradientFillStyle = (NGradientFillStyle)m_Chart.Wall(ChartWallType.Back).FillStyle; gradientFillStyle.Style = (Nevron.GraphicsCore.GradientStyle)StyleComboWalls.SelectedIndex; m_Chart.Wall(ChartWallType.Back).FillStyle = gradientFillStyle; m_Chart.Wall(ChartWallType.Left).FillStyle = gradientFillStyle; m_Chart.Wall(ChartWallType.Floor).FillStyle = gradientFillStyle; nChartControl1.Refresh(); }
protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithPercents(LengthBottomAxisDropDownList, 10); WebExamplesUtilities.FillComboWithPercents(LengthLeftAxisDropDownList, 10); } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel header = nChartControl1.Labels.AddHeader("Axis Model Crossing <br/> <font size = '9pt'>Demonstrates how to use the model cross anchor</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(7, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); m_Chart = nChartControl1.Charts[0]; m_Chart.BoundsMode = BoundsMode.Stretch; m_Chart.Location = new NPointL( new NLength(7, NRelativeUnit.ParentPercentage), new NLength(18, NRelativeUnit.ParentPercentage)); m_Chart.Size = new NSizeL( new NLength(86, NRelativeUnit.ParentPercentage), new NLength(75, NRelativeUnit.ParentPercentage)); // configure scales NLinearScaleConfigurator yScaleConfigurator = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; NScaleStripStyle yStripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(40, Color.LightGray)), null, true, 0, 0, 1, 1); yStripStyle.SetShowAtWall(ChartWallType.Back, true); yStripStyle.Interlaced = true; yScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); yScaleConfigurator.StripStyles.Add(yStripStyle); NLinearScaleConfigurator xScaleConfigurator = new NLinearScaleConfigurator(); NScaleStripStyle xStripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(40, Color.LightGray)), null, true, 0, 0, 1, 1); xStripStyle.SetShowAtWall(ChartWallType.Back, true); xStripStyle.Interlaced = true; xScaleConfigurator.StripStyles.Add(xStripStyle); xScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = xScaleConfigurator; // cross X and Y axes m_Chart.Axis(StandardAxis.PrimaryX).Anchor = new NCrossAxisAnchor(AxisOrientation.Horizontal, new NValueAxisCrossing(m_Chart.Axis(StandardAxis.PrimaryY), 0)); m_Chart.Axis(StandardAxis.PrimaryX).Anchor.RulerOrientation = RulerOrientation.Right; m_Chart.Axis(StandardAxis.PrimaryY).Anchor = new NCrossAxisAnchor(AxisOrientation.Vertical, new NValueAxisCrossing(m_Chart.Axis(StandardAxis.PrimaryX), 0)); m_Chart.Axis(StandardAxis.Depth).Visible = false; m_Chart.Wall(ChartWallType.Floor).Visible = false; m_Chart.Wall(ChartWallType.Left).Visible = false; // setup bubble series NBubbleSeries bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); bubble.Name = "Bubble Series"; bubble.InflateMargins = true; bubble.DataLabelStyle.Visible = false; bubble.UseXValues = true; bubble.ShadowStyle.Type = ShadowType.GaussianBlur; bubble.BubbleShape = PointShape.Sphere; bubble.Legend.Mode = SeriesLegendMode.None; // fill with random data bubble.Values.FillRandomRange(Random, 10, -20, 20); bubble.XValues.FillRandomRange(Random, 10, -20, 20); bubble.Sizes.FillRandomRange(Random, 10, 1, 6); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); UpdateCrossings(); }
private void BuildNewNChart(byte[] m_map_content) { try { DataTable dt = (DataTable)gridControl1.DataSource; nChartControl1 = new NChartControl(); nChartControl1.Settings.ShapeRenderingMode = ShapeRenderingMode.HighSpeed; nChartControl1.Controller.Tools.Add(new NSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); nChartControl1.MouseWheel += new MouseEventHandler(nChartControl1_MouseWheel); nChartControl1.MouseDown += new MouseEventHandler(nChartControl1_MouseDown); nChartControl1.MouseUp += new MouseEventHandler(nChartControl1_MouseUp); nChartControl1.Dock = DockStyle.Fill; xtraTabPage2.Controls.Add(nChartControl1); //nChartControl1.Charts.Clear(); NChart chart = nChartControl1.Charts[0]; nChartControl1.Legends.Clear(); chart.Enable3D = true; chart.Width = 60.0f; chart.Depth = 60.0f; chart.Height = 35.0f; chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft); NStandardScaleConfigurator scaleConfiguratorX = (NStandardScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; scaleConfiguratorX.MaxTickCount = dt.Rows.Count; scaleConfiguratorX.MajorTickMode = MajorTickMode.AutoMaxCount; //scaleConfiguratorX.AutoLabels = true; NScaleTitleStyle titleStyleX = (NScaleTitleStyle)scaleConfiguratorX.Title; titleStyleX.Text = Y_axis_name; //<GS-08032010> as waarden nog omzetten indien noodzakelijk (MAP etc) scaleConfiguratorX.AutoLabels = false; scaleConfiguratorX.Labels.Clear(); for (int t = y_axisvalues.Length - 1; t >= 0; t--) { string yvalue = y_axisvalues.GetValue(t).ToString(); //if (Y_axis_name == "MAP" || Y_axis_name == "Pressure error (bar)") { try { float v = (float)Convert.ToDouble(yvalue); yvalue = v.ToString("F2"); } catch (Exception cE) { logger.Debug(cE.Message); } } scaleConfiguratorX.Labels.Add(yvalue); } NStandardScaleConfigurator scaleConfiguratorY = (NStandardScaleConfigurator)chart.Axis(StandardAxis.Depth).ScaleConfigurator; scaleConfiguratorY.MajorTickMode = MajorTickMode.AutoMaxCount; scaleConfiguratorY.MaxTickCount = dt.Columns.Count; //scaleConfiguratorY.AutoLabels = true; NScaleTitleStyle titleStyleY = (NScaleTitleStyle)scaleConfiguratorY.Title; titleStyleY.Text = X_axis_name; scaleConfiguratorY.AutoLabels = false; scaleConfiguratorY.Labels.Clear(); for (int t = 0; t < x_axisvalues.Length; t++) { string xvalue = x_axisvalues.GetValue(t).ToString(); //if (X_axis_name == "MAP" || X_axis_name == "Pressure error (bar)") { try { float v = (float)Convert.ToDouble(xvalue); xvalue = v.ToString("F2"); } catch (Exception cE) { logger.Debug(cE.Message); } } scaleConfiguratorY.Labels.Add(xvalue); } NStandardScaleConfigurator scaleConfiguratorZ = (NStandardScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; scaleConfiguratorZ.MajorTickMode = MajorTickMode.AutoMaxCount; NScaleTitleStyle titleStyleZ = (NScaleTitleStyle)scaleConfiguratorZ.Title; titleStyleZ.Text = Z_axis_name; scaleConfiguratorZ.AutoLabels = true; chart.Wall(ChartWallType.Back).Visible = false; chart.Wall(ChartWallType.Left).Visible = false; chart.Wall(ChartWallType.Right).Visible = false; chart.Wall(ChartWallType.Floor).Visible = false; NMeshSurfaceSeries surface = null; chart.Series.Clear(); if (chart.Series.Count == 0) { surface = (NMeshSurfaceSeries)chart.Series.Add(SeriesType.MeshSurface); } else { surface = (NMeshSurfaceSeries)chart.Series[0]; } surface.Name = "Surface"; surface.PositionValue = 10.0; surface.Palette.Clear(); surface.Data.SetGridSize(dt.Columns.Count, dt.Rows.Count); surface.ValueFormatter.FormatSpecifier = "0.00"; surface.FillMode = SurfaceFillMode.Zone; // <GS-08032010> surface.SmoothPalette = true; surface.FrameColorMode = SurfaceFrameColorMode.Uniform; surface.FillStyle.SetTransparencyPercent(25); surface.FrameMode = SurfaceFrameMode.MeshContour; double diff = m_realMaxValue - m_realMinValue; surface.Palette.Add(m_realMinValue, Color.Green); surface.Palette.Add(m_realMinValue + 0.25 * diff, Color.Yellow); surface.Palette.Add(m_realMinValue + 0.50 * diff, Color.Orange); surface.Palette.Add(m_realMinValue + 0.75 * diff, Color.OrangeRed); surface.Palette.Add(m_realMinValue + diff, Color.Red); surface.PaletteSteps = 4; surface.AutomaticPalette = false; FillData(surface, dt); // hier nChartControl1.Refresh(); } catch (Exception E) { logger.Debug("Failed to refresh mesh chart: " + E.Message); } }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Axis Model Crossing <br/> <font size = '9pt'>Demonstrates how to use of the model cross anchor</font>"); title.TextStyle.TextFormat = TextFormat.XML; title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Center; title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // no legends nChartControl1.Legends.Clear(); m_Chart = nChartControl1.Charts[0]; // configure scales NLinearScaleConfigurator yScaleConfigurator = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; NScaleStripStyle yStripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(40, Color.LightGray)), null, true, 0, 0, 1, 1); yStripStyle.SetShowAtWall(ChartWallType.Back, true); yStripStyle.Interlaced = true; yScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); yScaleConfigurator.StripStyles.Add(yStripStyle); NLinearScaleConfigurator xScaleConfigurator = new NLinearScaleConfigurator(); NScaleStripStyle xStripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(40, Color.LightGray)), null, true, 0, 0, 1, 1); xStripStyle.SetShowAtWall(ChartWallType.Back, true); xStripStyle.Interlaced = true; xScaleConfigurator.StripStyles.Add(xStripStyle); xScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = xScaleConfigurator; // cross X and Y axes m_Chart.Axis(StandardAxis.PrimaryX).Anchor = new NCrossAxisAnchor(AxisOrientation.Horizontal, new NValueAxisCrossing(m_Chart.Axis(StandardAxis.PrimaryY), 0)); m_Chart.Axis(StandardAxis.PrimaryX).Anchor.RulerOrientation = RulerOrientation.Right; m_Chart.Axis(StandardAxis.PrimaryY).Anchor = new NCrossAxisAnchor(AxisOrientation.Vertical, new NValueAxisCrossing(m_Chart.Axis(StandardAxis.PrimaryX), 0)); m_Chart.Axis(StandardAxis.Depth).Visible = false; m_Chart.Wall(ChartWallType.Floor).Visible = false; m_Chart.Wall(ChartWallType.Left).Visible = false; // setup bubble series NBubbleSeries bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); bubble.Name = "Bubble Series"; bubble.InflateMargins = true; bubble.DataLabelStyle.Visible = false; bubble.UseXValues = true; bubble.BubbleShape = PointShape.Sphere; // fill with random data bubble.Values.FillRandomRange(Random, 10, -20, 20); bubble.XValues.FillRandomRange(Random, 10, -20, 20); bubble.Sizes.FillRandomRange(Random, 10, 1, 6); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); // init form controls LeftAxisAlignmentComboBox.FillFromEnum(typeof(HorzAlign)); LeftAxisAlignmentComboBox.SelectedIndex = (int)HorzAlign.Center; LeftAxisOffsetUC.Length = new NLength(0, NRelativeUnit.ParentPercentage); BottomAxisAlignmentComboBox.FillFromEnum(typeof(VertAlign)); BottomAxisAlignmentComboBox.SelectedIndex = (int)HorzAlign.Center; BottomAxisOffsetUC.Length = new NLength(0, NRelativeUnit.ParentPercentage); m_Updating = false; UpdateCrossings(); }
private void WallsDiffuseButton_Click(object sender, System.EventArgs e) { colorDialog1.Color = m_Chart.Wall(ChartWallType.Back).FillStyle.MaterialStyle.Diffuse; if (colorDialog1.ShowDialog() == DialogResult.OK) { m_Chart.Wall(ChartWallType.Back).FillStyle.MaterialStyle.Diffuse = colorDialog1.Color; m_Chart.Wall(ChartWallType.Left).FillStyle.MaterialStyle.Diffuse = colorDialog1.Color; m_Chart.Wall(ChartWallType.Floor).FillStyle.MaterialStyle.Diffuse = colorDialog1.Color; nChartControl1.Refresh(); } }
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(); }
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; }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Axis Value Crossing <br/> <font size = '9pt'>Demonstrates how to use of the value cross anchor</font>"); title.TextStyle.TextFormat = TextFormat.XML; title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // turn off the legend nChartControl1.Legends[0].Mode = LegendMode.Disabled; m_Chart = nChartControl1.Charts[0]; m_Chart.Enable3D = true; m_Chart.Width = m_Chart.Height = m_Chart.Depth = 50; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.NorthernLights); NAxis xAxis = m_Chart.Axis(StandardAxis.PrimaryX); NAxis yAxis = m_Chart.Axis(StandardAxis.PrimaryY); NAxis zAxis = m_Chart.Axis(StandardAxis.Depth); // cross X and Y axes xAxis.Anchor = new NCrossAxisAnchor(AxisOrientation.Horizontal); ((NCrossAxisAnchor)xAxis.Anchor).Crossings.Add(new NValueAxisCrossing(yAxis, 0)); ((NCrossAxisAnchor)xAxis.Anchor).Crossings.Add(new NValueAxisCrossing(zAxis, 0)); yAxis.Anchor = new NCrossAxisAnchor(AxisOrientation.Vertical); ((NCrossAxisAnchor)yAxis.Anchor).Crossings.Add(new NValueAxisCrossing(xAxis, 0)); ((NCrossAxisAnchor)yAxis.Anchor).Crossings.Add(new NValueAxisCrossing(zAxis, 0)); zAxis.Anchor = new NCrossAxisAnchor(AxisOrientation.Depth); ((NCrossAxisAnchor)zAxis.Anchor).Crossings.Add(new NValueAxisCrossing(xAxis, 0)); ((NCrossAxisAnchor)zAxis.Anchor).Crossings.Add(new NValueAxisCrossing(yAxis, 0)); m_Chart.Wall(ChartWallType.Back).Visible = false; m_Chart.Wall(ChartWallType.Floor).Visible = false; m_Chart.Wall(ChartWallType.Left).Visible = false; // setup bubble series NBubbleSeries bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); bubble.Name = "Bubble Series"; bubble.InflateMargins = true; bubble.DataLabelStyle.Visible = false; bubble.UseXValues = true; bubble.UseZValues = true; bubble.BubbleShape = PointShape.Sphere; // fill with random data bubble.Values.FillRandomRange(Random, 10, -20, 20); bubble.XValues.FillRandomRange(Random, 10, -20, 20); bubble.ZValues.FillRandomRange(Random, 10, -20, 20); bubble.Sizes.FillRandomRange(Random, 10, 1, 6); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); XUsePositionCheck.Checked = true; YUsePositionCheck.Checked = true; ZUsePositionCheck.Checked = true; nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); }
public override void Initialize() { base.Initialize(); nChartControl1.Settings.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Line Studies"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // setup chart 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.Height = 40; chart.Location = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(75, NRelativeUnit.ParentPercentage)); // setup X axis NAxis axis = chart.Axis(StandardAxis.PrimaryX); NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); axis.ScaleConfigurator = dateTimeScale; dateTimeScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; dateTimeScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); dateTimeScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, false); dateTimeScale.InnerMajorTickStyle.Length = new NLength(0); dateTimeScale.RoundToTickMin = true; dateTimeScale.RoundToTickMax = true; dateTimeScale.LabelGenerationMode = LabelGenerationMode.Stagger2; dateTimeScale.LabelFitModes = new LabelFitMode[] { LabelFitMode.AutoScale }; // setup primary Y axis axis = chart.Axis(StandardAxis.PrimaryY); NStandardScaleConfigurator standardScale = (NStandardScaleConfigurator)axis.ScaleConfigurator; standardScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; standardScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, false); NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); standardScale.StripStyles.Add(stripStyle); standardScale.InnerMajorTickStyle.Length = new NLength(0); Color customColor = Color.FromArgb(150, 150, 200); // setup the stock series NStockSeries stock = (NStockSeries)chart.Series.Add(SeriesType.Stock); stock.DataLabelStyle.Visible = false; stock.CandleStyle = CandleStyle.Bar; stock.CandleWidth = new NLength(0.5f, NRelativeUnit.ParentPercentage); stock.HighLowStrokeStyle.Color = customColor; stock.UpStrokeStyle.Width = new NLength(0); stock.DownStrokeStyle.Width = new NLength(0); stock.UpFillStyle = new NColorFillStyle(Color.LightGreen); stock.DownFillStyle = new NColorFillStyle(customColor); stock.Legend.Mode = SeriesLegendMode.SeriesLogic; stock.UseXValues = true; stock.InflateMargins = true; GenerateData(); // form controls ShowTextsCheck.Checked = true; FinancialMarkerCombo.SelectedIndex = 2; TrendlineModeCombo.SelectedIndex = 2; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; NChart chart = nChartControl1.Charts[0]; chart.Width = 100; chart.Height = 60; chart.BoundsMode = BoundsMode.Fit; chart.Location = new NPointL( new NLength(10, NRelativeUnit.ParentPercentage), new NLength(20, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL( new NLength(80, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage)); chart.Axis(StandardAxis.Depth).Visible = false; chart.Wall(ChartWallType.Back).Visible = false; m_Line1 = (NLineSeries)chart.Series.Add(SeriesType.Line); m_Line1.Name = "Line 1"; m_Line1.DataLabelStyle.Visible = false; m_Line1.BorderStyle.Color = Color.DodgerBlue; m_Line1.FillStyle = new NColorFillStyle(Color.DodgerBlue); m_Line1.MarkerStyle.FillStyle = new NColorFillStyle(Color.DodgerBlue); m_Line1.MarkerStyle.BorderStyle.Color = Color.DodgerBlue; m_Line1.MarkerStyle.PointShape = PointShape.Cylinder; m_Line1.MarkerStyle.Visible = true; m_Line1.ShadowStyle.Type = ShadowType.GaussianBlur; m_Line2 = (NLineSeries)chart.Series.Add(SeriesType.Line); m_Line2.Name = "Line 2"; m_Line2.MultiLineMode = MultiLineMode.Overlapped; m_Line2.DataLabelStyle.Visible = false; m_Line2.BorderStyle.Color = Color.Orange; m_Line2.FillStyle = new NColorFillStyle(Color.Orange); m_Line2.MarkerStyle.FillStyle = new NColorFillStyle(Color.Orange); m_Line2.MarkerStyle.BorderStyle.Color = Color.Orange; m_Line2.MarkerStyle.PointShape = PointShape.Cylinder; m_Line2.MarkerStyle.Visible = true; m_Line2.ShadowStyle.Type = ShadowType.GaussianBlur; m_Bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); m_Bar.DataLabelStyle.Visible = false; for (int i = 0; i < m_Bar.Values.Count; i++) { m_Bar.FillStyles[i] = new NColorFillStyle(WebExamplesUtilities.RandomColor()); } m_Bar.Name = "Bar 1"; GenerateData(); // add header NLabel header = nChartControl1.Labels.AddHeader("Basic SVG Chart"); header.TextStyle.BackplaneStyle.Visible = false; header.TextStyle.ShadowStyle.Type = ShadowType.GaussianBlur; header.TextStyle.FillStyle = new NColorFillStyle(Color.Black); header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL(new NLength(3, NRelativeUnit.ParentPercentage), new NLength(3, NRelativeUnit.ParentPercentage)); NImageResponse svgImageResponse = new NImageResponse(); NSvgImageFormat svgImageFormat = new NSvgImageFormat(); svgImageResponse.ImageFormat = svgImageFormat; nChartControl1.ServerSettings.BrowserResponseSettings.DefaultResponse = svgImageResponse; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { FunctionDropDownList.Items.Add("Average"); FunctionDropDownList.Items.Add("Min"); FunctionDropDownList.Items.Add("Max"); FunctionDropDownList.SelectedIndex = 0; 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; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // add header NLabel header = nChartControl1.Labels.AddHeader("Average, Min, Max"); 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)); nFuncCalculator = new NFunctionCalculator(); // 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); // setup chart 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 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.Legend.Mode = SeriesLegendMode.None; nLine.Values.ValueFormatter = new NNumericValueFormatter("0.00"); nLine.DisplayOnAxis(StandardAxis.PrimaryX, false); nLine.DisplayOnAxis(StandardAxis.SecondaryX, true); 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.Cylinder; nBar.BorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); nBar.FillStyle = new NColorFillStyle(Color.DarkSalmon); nBar.Values.FillRandomRange(Random, 12, 0, 50); 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); } BuildExpression(); CalcFunction(); }
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; // set a chart title NLabel header = nChartControl1.Labels.AddHeader("Train Sales"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL( new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); nChartControl1.Legends[0].Mode = LegendMode.Disabled; NChart chart = nChartControl1.Charts[0]; // perform manual stretch float fAspect = ((float)nChartControl1.Width.Value / (float)nChartControl1.Height.Value); // perform manual stretch if (fAspect > 1) { chart.Width = 86 * fAspect; chart.Height = 70; } else { chart.Width = 86; chart.Height = 70 * fAspect; } chart.Location = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(18, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL(new NLength(86, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage)); chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); chart.Wall(ChartWallType.Floor).Visible = false; chart.Wall(ChartWallType.Left).Visible = false; chart.Axis(StandardAxis.Depth).Visible = false; chart.Axis(StandardAxis.Depth).Visible = false; NOrdinalScaleConfigurator ordinalScaleConfigurator = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; ordinalScaleConfigurator.InnerMajorTickStyle.LineStyle.Width = new NLength(0, NGraphicsUnit.Pixel); ordinalScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; ordinalScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, false); ordinalScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); NDockAxisAnchor anchor = new NDockAxisAnchor(AxisDockZone.FrontBottom, false, 5, 95); chart.Axis(StandardAxis.PrimaryX).Anchor = anchor; NLinearScaleConfigurator linearSclaeConfigurator = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearSclaeConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; NLineSeries line = (NLineSeries)chart.Series.Add(SeriesType.Line); NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.Name = "Bar Series"; bar.BorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); bar.FillStyle = new NColorFillStyle(Color.MediumPurple); bar.DataLabelStyle.Visible = false; bar.InflateMargins = true; // fill with random data Random random = new Random(); bar.Values.FillRandom(random, 10); // generate a data series cumulative sum of the bar values NFunctionCalculator fc = new NFunctionCalculator(); fc.Expression = "CUMSUM(Value)"; fc.Arguments.Add(bar.Values); // display this data series as line line.Name = "Cumulative"; line.Values = fc.Calculate(); line.MarkerStyle.Visible = true; line.MarkerStyle.PointShape = PointShape.Cylinder; line.DataLabelStyle.Visible = false; line.DataLabelStyle.ArrowStrokeStyle.Width = new NLength(0, NGraphicsUnit.Pixel); bar.BarShape = BarShape.Cylinder; for (int i = 0; i < bar.Values.Count; i++) { bar.FillStyles[i] = new NColorFillStyle(WebExamplesUtilities.RandomColor()); } bar.Legend.Mode = SeriesLegendMode.DataPoints; line.Legend.Mode = SeriesLegendMode.None; NImageResponse imageResponse = new NImageResponse(); imageResponse.StreamImageToBrowser = true; nChartControl1.ServerSettings.BrowserResponseSettings.DefaultResponse = imageResponse; nChartControl1.RenderControl(null); }
public override void Initialize() { base.Initialize(); // load textures from resources Bitmap bmp0 = NResourceHelper.BitmapFromResource(this.GetType(), "Back.png", "Nevron.Examples.Chart.WinForm.Resources"); Bitmap bmp1 = NResourceHelper.BitmapFromResource(this.GetType(), "Leafs.png", "Nevron.Examples.Chart.WinForm.Resources"); Bitmap bmp2 = NResourceHelper.BitmapFromResource(this.GetType(), "Banner.png", "Nevron.Examples.Chart.WinForm.Resources"); NImageFillStyle imageFillStyle = new NImageFillStyle(bmp0); imageFillStyle.TextureMappingStyle.MapLayout = MapLayout.Tiled; nChartControl1.BackgroundStyle.FillStyle = imageFillStyle; // add label NLabel title = nChartControl1.Labels.AddHeader("Image Fill Style"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // setup chart and axes m_Chart = nChartControl1.Charts[0]; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.SoftTopLeft); m_Chart.Axis(StandardAxis.Depth).Visible = false; NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.LineStyle.Color = Color.White; linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.LineStyle.Color = Color.White; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); // Setup walls Color c = Color.FromArgb(128, 128, 192); imageFillStyle = new NImageFillStyle(bmp1); imageFillStyle.TextureMappingStyle.MapLayout = MapLayout.Tiled; m_Chart.Wall(ChartWallType.Back).FillStyle = imageFillStyle; m_Chart.Wall(ChartWallType.Left).FillStyle = imageFillStyle; m_Chart.Wall(ChartWallType.Floor).FillStyle = imageFillStyle; // create bubble chart m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); m_Bubble.DataLabelStyle.Visible = false; m_Bubble.Legend.Mode = SeriesLegendMode.DataPoints; m_Bubble.BubbleShape = PointShape.Ellipse; m_Bubble.UseXValues = true; m_Bubble.InflateMargins = true; m_Bubble.BorderStyle.Width = new NLength(1, NGraphicsUnit.Pixel); m_Bubble.FillStyle = new NImageFillStyle(bmp2); GenerateData(); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Axis Value Crossing <br/> <font size = '9pt'>Demonstrates how to use of the value cross anchor</font>"); title.TextStyle.TextFormat = TextFormat.XML; title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // turn off the legend nChartControl1.Legends[0].Mode = LegendMode.Disabled; m_Chart = nChartControl1.Charts[0]; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.NorthernLights); // configure scales NLinearScaleConfigurator yScaleConfigurator = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; NScaleStripStyle yStripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(40, Color.LightGray)), null, true, 0, 0, 1, 1); yStripStyle.SetShowAtWall(ChartWallType.Back, true); yStripStyle.Interlaced = true; yScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); yScaleConfigurator.StripStyles.Add(yStripStyle); NLinearScaleConfigurator xScaleConfigurator = new NLinearScaleConfigurator(); NScaleStripStyle xStripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(40, Color.LightGray)), null, true, 0, 0, 1, 1); xStripStyle.SetShowAtWall(ChartWallType.Back, true); xStripStyle.Interlaced = true; xScaleConfigurator.StripStyles.Add(xStripStyle); xScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = xScaleConfigurator; // cross X and Y axes m_Chart.Axis(StandardAxis.PrimaryX).Anchor = new NCrossAxisAnchor(AxisOrientation.Horizontal, new NValueAxisCrossing(m_Chart.Axis(StandardAxis.PrimaryY), 0)); m_Chart.Axis(StandardAxis.PrimaryX).Anchor.RulerOrientation = RulerOrientation.Right; m_Chart.Axis(StandardAxis.PrimaryY).Anchor = new NCrossAxisAnchor(AxisOrientation.Vertical, new NValueAxisCrossing(m_Chart.Axis(StandardAxis.PrimaryX), 0)); m_Chart.Axis(StandardAxis.Depth).Visible = false; m_Chart.Wall(ChartWallType.Floor).Visible = false; m_Chart.Wall(ChartWallType.Left).Visible = false; // setup bubble series NBubbleSeries bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); bubble.Name = "Bubble Series"; bubble.InflateMargins = true; bubble.DataLabelStyle.Visible = false; bubble.UseXValues = true; bubble.BubbleShape = PointShape.Sphere; // fill with random data bubble.Values.FillRandomRange(Random, 10, -20, 20); bubble.XValues.FillRandomRange(Random, 10, -20, 20); bubble.Sizes.FillRandomRange(Random, 10, 1, 6); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); // init form controls LeftAxisScroll.Minimum = -30; LeftAxisScroll.Maximum = 30; LeftAxisScroll.Value = 0; BottomAxisScroll.Minimum = -30; BottomAxisScroll.Maximum = 30; BottomAxisScroll.Value = 0; LeftAxisLabel.Text = LeftAxisScroll.Value.ToString(); BottomAxisLabel.Text = BottomAxisScroll.Value.ToString(); LeftUsePositionCheck.Checked = true; BottomUsePositionCheck.Checked = true; }
private void HatchComboWalls_SelectedIndexChanged(object sender, System.EventArgs e) { if (m_bSkipUpdate) { return; } HatchStyle style = GetHatchStyleFromCombo(HatchComboWalls); ((NHatchFillStyle)m_Chart.Wall(ChartWallType.Back).FillStyle).Style = style; ((NHatchFillStyle)m_Chart.Wall(ChartWallType.Left).FillStyle).Style = style; ((NHatchFillStyle)m_Chart.Wall(ChartWallType.Floor).FillStyle).Style = style; nChartControl1.Refresh(); }
private NInteractivityStyle GetCurrentInteractivityStyle() { NInteractivityStyle interactivityStyle = null; switch (ChartObjectComboBox.SelectedIndex) { // Background case 0: interactivityStyle = nChartControl1.InteractivityStyle; break; // Back chart wall case 1: interactivityStyle = m_Chart.Wall(ChartWallType.Back).InteractivityStyle; break; // Left chart wall case 2: interactivityStyle = m_Chart.Wall(ChartWallType.Left).InteractivityStyle; break; /// Floor chart wall case 3: interactivityStyle = m_Chart.Wall(ChartWallType.Floor).InteractivityStyle; break; // Primary Y axis case 4: interactivityStyle = m_Chart.Axis(StandardAxis.PrimaryY).InteractivityStyle; break; // Primary X axis case 5: interactivityStyle = m_Chart.Axis(StandardAxis.PrimaryX).InteractivityStyle; break; // Horizontal stripe case 6: interactivityStyle = ((NAxisStripe)(m_Chart.Axis(StandardAxis.PrimaryY).Stripes[0])).InteractivityStyle; break; // Vertical stripe case 7: interactivityStyle = ((NAxisStripe)(m_Chart.Axis(StandardAxis.PrimaryX).Stripes[0])).InteractivityStyle; break; // Legend case 8: interactivityStyle = ((NLegend)(nChartControl1.Legends[0])).InteractivityStyle; break; case 9: case 10: case 11: case 12: case 13: NSeries series = (NSeries)m_Chart.Series[0]; interactivityStyle = (NInteractivityStyle)(series.InteractivityStyles[ChartObjectComboBox.SelectedIndex - 9]); break; } return(interactivityStyle); }
public override void Initialize() { base.Initialize(); // Set background gradient nChartControl1.BackgroundStyle.FillStyle = new NGradientFillStyle(Nevron.GraphicsCore.GradientStyle.DiagonalUp, GradientVariant.Variant3, Color.FromArgb(187, 221, 255), Color.White); // add label NLabel title = nChartControl1.Labels.AddHeader("Gradient Fill Style"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NGradientFillStyle(Nevron.GraphicsCore.GradientStyle.Horizontal, GradientVariant.Variant1, Color.MidnightBlue, Color.PaleVioletRed); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // setup chart m_Chart = nChartControl1.Charts[0]; m_Chart.Axis(StandardAxis.Depth).Visible = false; NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScale.MajorGridStyle.LineStyle.Color = Color.White; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; NOrdinalScaleConfigurator ordinalScale = (NOrdinalScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; ordinalScale.MajorGridStyle.LineStyle.Color = Color.White; ordinalScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); m_Chart.Projection.Rotation = -14; m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft); // Setup walls Color c = Color.FromArgb(128, 128, 192); NGradientFillStyle wallGradientFillStyle = new NGradientFillStyle(Nevron.GraphicsCore.GradientStyle.Horizontal, GradientVariant.Variant1, c, Color.White); m_Chart.Wall(ChartWallType.Back).FillStyle = wallGradientFillStyle; m_Chart.Wall(ChartWallType.Left).FillStyle = wallGradientFillStyle; m_Chart.Wall(ChartWallType.Floor).FillStyle = wallGradientFillStyle; // Create a bar series m_Bar = (NFloatBarSeries)m_Chart.Series.Add(SeriesType.FloatBar); m_Bar.DataLabelStyle.Visible = false; m_Bar.BarShape = BarShape.Bar; m_Bar.BarEdgePercent = 50; m_Bar.WidthPercent = 60; m_Bar.DepthPercent = 60; m_Bar.Legend.Mode = SeriesLegendMode.DataPoints; m_Bar.FillStyle = new NGradientFillStyle(Nevron.GraphicsCore.GradientStyle.Horizontal, GradientVariant.Variant1, Color.Green, Color.Yellow); m_Bar.AddDataPoint(new NFloatBarDataPoint(2.0, 24.0)); m_Bar.AddDataPoint(new NFloatBarDataPoint(21.0, 60.0)); m_Bar.AddDataPoint(new NFloatBarDataPoint(22.0, 53.0)); m_Bar.AddDataPoint(new NFloatBarDataPoint(34.0, 80.0)); m_Bar.AddDataPoint(new NFloatBarDataPoint(11.0, 62.0)); // init form controls FillStyleCombo(StyleComboBars); FillStyleCombo(StyleComboWalls); FillStyleCombo(StyleComboBack); FillVariantCombo(VariantComboBars); FillVariantCombo(VariantComboWalls); FillVariantCombo(VariantComboBack); m_bSkipUpdate = true; StyleComboBars.SelectedIndex = (int)((NGradientFillStyle)m_Bar.FillStyle).Style; VariantComboBars.SelectedIndex = (int)((NGradientFillStyle)m_Bar.FillStyle).Variant; StyleComboWalls.SelectedIndex = (int)((NGradientFillStyle)m_Chart.Wall(ChartWallType.Back).FillStyle).Style; VariantComboWalls.SelectedIndex = (int)((NGradientFillStyle)m_Chart.Wall(ChartWallType.Back).FillStyle).Variant; StyleComboBack.SelectedIndex = (int)((NGradientFillStyle)nChartControl1.BackgroundStyle.FillStyle).Style; VariantComboBack.SelectedIndex = (int)((NGradientFillStyle)nChartControl1.BackgroundStyle.FillStyle).Variant; m_bSkipUpdate = false; }
public override void Initialize() { base.Initialize(); const int nNumberOfWeeks = 20; const int nWorkDaysInWeek = 5; const int nDaysInWeek = 7; const int nTotalWorkDays = nNumberOfWeeks * nWorkDaysInWeek; const int nTotalDays = nNumberOfWeeks * nDaysInWeek; const int nHistoricalDays = 20; NLabel title = nChartControl1.Labels.AddHeader("Financial Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // setup chart m_Chart = nChartControl1.Charts[0]; m_Chart.BoundsMode = BoundsMode.Fit; m_Chart.Location = new NPointL(new NLength(7, NRelativeUnit.ParentPercentage), new NLength(10, NRelativeUnit.ParentPercentage)); m_Chart.Size = new NSizeL(new NLength(86, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage)); m_Chart.Height = 30; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); m_Chart.Wall(ChartWallType.Floor).Visible = false; m_Chart.Wall(ChartWallType.Left).Visible = false; m_Chart.Wall(ChartWallType.Back).Width = 0; m_Chart.Wall(ChartWallType.Back).FillStyle = new NColorFillStyle(Color.FromArgb(239, 245, 239)); m_Chart.Axis(StandardAxis.Depth).Visible = false; // setup y axis NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.LineStyle.Color = Color.Gray; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, false); // setup x axis NAxis axisX1 = m_Chart.Axis(StandardAxis.PrimaryX); linearScale = new NLinearScaleConfigurator(); axisX1.ScaleConfigurator = linearScale; linearScale.AutoLabels = false; linearScale.MinorTickCount = 4; linearScale.MajorTickMode = MajorTickMode.CustomStep; linearScale.CustomStep = 5; linearScale.RoundToTickMax = false; linearScale.RoundToTickMin = false; linearScale.OuterMajorTickStyle.Length = new NLength(4, NGraphicsUnit.Point); linearScale.InnerMajorTickStyle.Length = new NLength(0, NGraphicsUnit.Point); linearScale.InnerMinorTickStyle.Length = new NLength(0, NGraphicsUnit.Point); linearScale.OuterMinorTickStyle.Length = new NLength(2, NGraphicsUnit.Point); linearScale.OuterMinorTickStyle.LineStyle.Color = Color.Brown; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, false); linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.LabelStyle.ValueScale = 0.2; // create a line series for the simple moving average m_LineSMA = (NLineSeries)m_Chart.Series.Add(SeriesType.Line); m_LineSMA.Name = "SMA(20)"; m_LineSMA.DataLabelStyle.Visible = false; m_LineSMA.BorderStyle.Color = Color.DarkOrange; // create the stock series m_Stock = (NStockSeries)m_Chart.Series.Add(SeriesType.Stock); m_Stock.Name = "Stock Data"; m_Stock.Legend.Mode = SeriesLegendMode.None; m_Stock.DataLabelStyle.Visible = false; m_Stock.CandleStyle = CandleStyle.Bar; m_Stock.CandleWidth = new NLength(5, NGraphicsUnit.Point); m_Stock.InflateMargins = false; m_Stock.UpFillStyle = new NColorFillStyle(LightOrange); m_Stock.UpStrokeStyle.Color = Color.Black; m_Stock.DownFillStyle = new NColorFillStyle(DarkOrange); m_Stock.DownStrokeStyle.Color = Color.Black; m_Stock.DisplayOnAxis(StandardAxis.PrimaryX, true); m_Stock.InflateMargins = true; m_Stock.OpenValues.Name = "open"; m_Stock.CloseValues.Name = "close"; m_Stock.HighValues.Name = "high"; m_Stock.LowValues.Name = "low"; // add the bollinger bands as high low area m_HighLow = (NHighLowSeries)m_Chart.Series.Add(SeriesType.HighLow); m_HighLow.Name = "BB(20, 2)"; m_HighLow.DataLabelStyle.Visible = false; m_HighLow.HighFillStyle = new NColorFillStyle(Color.FromArgb(80, 130, 134, 168)); m_HighLow.HighBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); m_HighLow.DisplayOnAxis(StandardAxis.SecondaryX, true); // generate some stock data GenerateOHLCData(m_Stock, 300, nTotalWorkDays + nHistoricalDays); // create a function calculator NFunctionCalculator fc = new NFunctionCalculator(); fc.Arguments.Add(m_Stock.CloseValues); // calculate the bollinger bands fc.Expression = "BOLLINGER(close; 20; 2)"; m_HighLow.HighValues = fc.Calculate(); m_HighLow.HighValues.Name = "BollingerUpper"; fc.Expression = "BOLLINGER(close; 20; -2)"; m_HighLow.LowValues = fc.Calculate(); m_HighLow.LowValues.Name = "BollingerLower"; // calculate the simple moving average fc.Expression = "SMA(close; 20)"; m_LineSMA.Values = fc.Calculate(); // remove data that won't be charted m_Stock.HighValues.RemoveRange(0, nHistoricalDays); m_Stock.LowValues.RemoveRange(0, nHistoricalDays); m_Stock.OpenValues.RemoveRange(0, nHistoricalDays); m_Stock.CloseValues.RemoveRange(0, nHistoricalDays); m_HighLow.HighValues.RemoveRange(0, nHistoricalDays); m_HighLow.LowValues.RemoveRange(0, nHistoricalDays); m_LineSMA.Values.RemoveRange(0, nHistoricalDays); GenerateDateLabels(nTotalDays); CandleStyleCombo.Items.Add("Candle"); CandleStyleCombo.Items.Add("Stick"); CandleStyleCombo.SelectedIndex = 0; NRangeSelection rangeSelection = new NRangeSelection(); rangeSelection.VerticalValueSnapper = new NAxisRulerMinMaxSnapper(); ((NCartesianChart)m_Chart).RangeSelections.Add(rangeSelection); nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NAxisScrollTool()); nChartControl1.Controller.Tools.Add(new NDataZoomTool()); nChartControl1.Controller.Tools.Add(new NDataPanTool()); }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { nChartControl1.Settings.ShapeRenderingMode = ShapeRenderingMode.HighSpeed; // set a chart title NLabel title = new NLabel("Contour Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); // setup chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Width = 70.0f; chart.Depth = 70.0f; chart.Height = 0.1f; chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalTop); chart.LightModel.EnableLighting = false; // hide chart walls chart.Wall(ChartWallType.Back).Visible = false; chart.Wall(ChartWallType.Left).Visible = false; chart.Wall(ChartWallType.Floor).Visible = false; // setup Y axis chart.Axis(StandardAxis.PrimaryY).Visible = false; // setup X axis NAxis axisX = chart.Axis(StandardAxis.PrimaryX); axisX.Anchor = new NDockAxisAnchor(AxisDockZone.FrontTop); NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator(); scaleX.InnerMajorTickStyle.Visible = false; scaleX.RoundToTickMin = false; scaleX.RoundToTickMax = false; axisX.ScaleConfigurator = scaleX; // setup Z axis NAxis axisZ = chart.Axis(StandardAxis.Depth); axisZ.Anchor = new NDockAxisAnchor(AxisDockZone.TopRight); NLinearScaleConfigurator scaleZ = new NLinearScaleConfigurator(); scaleZ.InnerMajorTickStyle.Visible = false; scaleZ.MajorGridStyle.ShowAtWalls = new ChartWallType[0]; scaleZ.RoundToTickMin = false; scaleZ.RoundToTickMax = false; axisZ.ScaleConfigurator = scaleZ; // add a surface series NGridSurfaceSeries surface = (NGridSurfaceSeries)chart.Series.Add(SeriesType.GridSurface); surface.Name = "Contour"; surface.Legend.Mode = SeriesLegendMode.SeriesLogic; surface.ValueFormatter = new NNumericValueFormatter("0.0"); surface.FillMode = SurfaceFillMode.Zone; surface.FrameMode = SurfaceFrameMode.Contour; surface.ShadingMode = ShadingMode.Flat; surface.DrawFlat = true; surface.Data.SetGridSize(31, 31); // setup a custom palette surface.AutomaticPalette = false; surface.Palette.Clear(); surface.Palette.Add(0.0, Color.Purple); surface.Palette.Add(1.5, Color.MediumSlateBlue); surface.Palette.Add(3.0, Color.CornflowerBlue); surface.Palette.Add(4.5, Color.LimeGreen); surface.Palette.Add(6.0, Color.LightGreen); surface.Palette.Add(7.5, Color.Yellow); surface.Palette.Add(9.0, Color.Orange); surface.Palette.Add(10.5, Color.Red); surface.Palette.Add(100, Color.Red); // fill the surface with data FillData(surface); // apply layout ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]); // setup form controls ShowFillingCheckBox.IsChecked = true; ShowFrameCheckBox.IsChecked = true; PaletteFrameCheckBox.IsChecked = true; SmoothPaletteCheckBox.IsChecked = true; DrawContourBorderCheckBox.IsChecked = true; UpdateChart(); }