public override void Initialize() { base.Initialize(); // set a chart title NLabel title = new NLabel("DateTime Step Line"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // no legend nChartControl1.Legends.Clear(); // configure the chart NChart chart = nChartControl1.Charts[0]; chart.Width = 90; chart.BoundsMode = BoundsMode.Stretch; 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); // switch the X axis in date time scale mode NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale; dateTimeScale.LabelGenerationMode = LabelGenerationMode.Stagger2; dateTimeScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); // setup step line series NStepLineSeries line = (NStepLineSeries)chart.Series.Add(SeriesType.StepLine); line.Name = "Step Line Series"; line.InflateMargins = true; line.UseXValues = true; line.UseZValues = false; line.DataLabelStyle.Visible = false; line.ShadowStyle.Type = ShadowType.Solid; line.ShadowStyle.Color = Color.FromArgb(15, 0, 0, 0); line.MarkerStyle.PointShape = PointShape.Cylinder; line.MarkerStyle.Width = new NLength(1.2f, NRelativeUnit.ParentPercentage); line.MarkerStyle.Height = new NLength(1.2f, NRelativeUnit.ParentPercentage); GenerateYValues(nValuesCount); GenerateXValues(nValuesCount); // apply layout ConfigureStandardLayout(chart, title, null); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); }
private void InitChart() { m_Chart = nChartControl1.Charts[0]; nChartControl1.Controller.Selection.Add(m_Chart); nChartControl1.Controller.Tools.Add(new NDataPanTool()); nChartControl1.Controller.Tools.Add(new NAxisScrollTool()); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Multi Page Printing"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.ContentAlignment = ContentAlignment.MiddleCenter; title.DockMargins = new NMarginsL(5, 5, 5, 5); title.DockMode = PanelDockMode.Top; nChartControl1.Legends[0].Mode = LegendMode.Disabled; // setup chart m_Chart.BoundsMode = BoundsMode.Stretch; m_Chart.DockMode = PanelDockMode.Fill; m_Chart.DockMargins = new NMarginsL(15, 20, 30, 20); m_Chart.Axis(StandardAxis.PrimaryY).ScrollBar.Visible = true; m_Chart.Axis(StandardAxis.PrimaryY).ScrollBar.ResetButton.Visible = false; NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); dateTimeScale.LabelGenerationMode = LabelGenerationMode.Stagger2; m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale; m_Chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true; m_Chart.Axis(StandardAxis.PrimaryX).ScrollBar.ResetButton.Visible = false; m_Chart.BringToFront(); // create the float bar series m_FloatBar = (NFloatBarSeries)m_Chart.Series.Add(SeriesType.FloatBar); m_FloatBar.UseXValues = true; m_FloatBar.UseZValues = false; m_FloatBar.InflateMargins = true; m_FloatBar.DataLabelStyle.Visible = false; // bar appearance m_FloatBar.BorderStyle.Color = Color.Bisque; m_FloatBar.FillStyle = new NGradientFillStyle(Nevron.GraphicsCore.GradientStyle.Horizontal, GradientVariant.Variant1, Color.LightGray, Color.DarkBlue); m_FloatBar.ShadowStyle.Type = ShadowType.Solid; m_FloatBar.ShadowStyle.Color = Color.FromArgb(30, 0, 0, 0); m_FloatBar.Values.ValueFormatter = new NNumericValueFormatter("0.00"); m_FloatBar.EndValues.ValueFormatter = new NNumericValueFormatter("0.00"); // show the begin end values in the legend m_FloatBar.Legend.Format = "<begin> - <end>"; m_FloatBar.Legend.Mode = SeriesLegendMode.DataPoints; GenerateData(); m_PrintManager = new NPrintManager(nChartControl1.Document); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("DateTime Bars"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // no legend nChartControl1.Legends.Clear(); // setup chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; NLinearScaleConfigurator linearScale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; // add interlace stripes to the Y axis NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 2, 1); stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); stripStyle.Interlaced = true; linearScale.StripStyles.Add(stripStyle); NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); dateTimeScale.LabelFitModes = new LabelFitMode[] { LabelFitMode.AutoScale }; dateTimeScale.LabelGenerationMode = LabelGenerationMode.Stagger2; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale; // setup bar series NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.Name = "Bar Series"; bar.InflateMargins = true; bar.UseXValues = true; bar.UseZValues = false; bar.DataLabelStyle.Visible = false; bar.ShadowStyle.Type = ShadowType.Solid; bar.ShadowStyle.Color = Color.FromArgb(30, 0, 0, 0); GenerateYValues(nValuesCount); GenerateXValues(nValuesCount); // apply layout ConfigureStandardLayout(chart, title, null); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); }
/* protected Label Label1; * protected Label Label2; * protected Label Label3; * protected DropDownList BarStyleDropDownList; * protected DropDownList WidthPercentDropDownList; * protected DropDownList DepthPercentDropDownList;*/ protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("DateTime Float Bar"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // setup chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; // setup Y axis NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; // 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); scaleY.StripStyles.Add(stripStyle); // setup X axis NDateTimeScaleConfigurator scaleX = new NDateTimeScaleConfigurator(); scaleX.LabelStyle.Angle = new NScaleLabelAngle(90); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // create the float bar series NFloatBarSeries floatBar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar); floatBar.UseXValues = true; floatBar.UseZValues = false; floatBar.InflateMargins = true; floatBar.DataLabelStyle.Visible = false; floatBar.ShadowStyle.Type = ShadowType.Solid; floatBar.ShadowStyle.Color = Color.FromArgb(30, 0, 0, 0); floatBar.Values.ValueFormatter = new NNumericValueFormatter("0.0"); floatBar.EndValues.ValueFormatter = new NNumericValueFormatter("0.0"); // show the begin end values in the legend floatBar.Legend.Format = "<begin> - <end>"; floatBar.Legend.Mode = SeriesLegendMode.DataPoints; GenerateData(floatBar); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); }
private void InitChart() { m_Chart = nChartControl1.Charts[0]; nChartControl1.Controller.Selection.Add(m_Chart); nChartControl1.Controller.Tools.Add(new NTrackballTool()); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Printing"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // setup chart m_Chart.Width = 90; m_Chart.BoundsMode = BoundsMode.Stretch; m_Chart.Location = new NPointL( new NLength(15, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); m_Chart.Size = new NSizeL( new NLength(70, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage)); NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale; dateTimeScale.LabelValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.Date); dateTimeScale.LabelGenerationMode = LabelGenerationMode.Stagger2; // create the float bar series m_FloatBar = (NFloatBarSeries)m_Chart.Series.Add(SeriesType.FloatBar); m_FloatBar.UseXValues = true; m_FloatBar.UseZValues = false; m_FloatBar.InflateMargins = true; m_FloatBar.DataLabelStyle.Visible = false; // bar appearance m_FloatBar.BorderStyle.Color = Color.Bisque; m_FloatBar.FillStyle = new NGradientFillStyle(Nevron.GraphicsCore.GradientStyle.Horizontal, GradientVariant.Variant1, Color.LightGray, Color.DarkBlue); m_FloatBar.ShadowStyle.Type = ShadowType.Solid; m_FloatBar.ShadowStyle.Color = Color.FromArgb(30, 0, 0, 0); m_FloatBar.Values.ValueFormatter = new NNumericValueFormatter("0.00"); m_FloatBar.EndValues.ValueFormatter = new NNumericValueFormatter("0.00"); // show the begin end values in the legend m_FloatBar.Legend.Format = "<begin> - <end>"; m_FloatBar.Legend.Mode = SeriesLegendMode.DataPoints; m_PrintManager = new NPrintManager(nChartControl1.Document); GenerateData(); }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Date Time Bars"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // no legend nChartControl1.Legends.Clear(); // setup chart NChart chart = nChartControl1.Charts[0]; // setup Y axis NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; // add interlace stripe to the Y axis NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; linearScale.StripStyles.Add(stripStyle); // setup X axis NDateTimeScaleConfigurator timeScale = new NDateTimeScaleConfigurator(); timeScale.MaxTickCount = 5; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = timeScale; // setup bar series NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.Name = "Bar Series"; bar.InflateMargins = true; bar.UseXValues = true; bar.UseZValues = false; bar.DataLabelStyle.Visible = false; bar.ShadowStyle.Type = ShadowType.Solid; bar.ShadowStyle.Color = Color.FromArgb(30, 0, 0, 0); GenreateYValues(nValuesCount); GenreateXValues(nValuesCount); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
private void SetupLineChart(NCartesianChart chart) { 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.DockMargins = new NMarginsL( new NLength(5, NRelativeUnit.ParentPercentage), new NLength(10, NRelativeUnit.ParentPercentage), new NLength(10, NRelativeUnit.ParentPercentage), new NLength(5, NRelativeUnit.ParentPercentage)); chart.BoundsMode = BoundsMode.Stretch; // setup X axis NAxis axis = chart.Axis(StandardAxis.PrimaryX); NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); 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.MaxTickCount = 8; dateTimeScale.MajorTickMode = MajorTickMode.AutoMaxCount; dateTimeScale.AutoDateTimeUnits = new NDateTimeUnit[] { NDateTimeUnit.Second }; dateTimeScale.RoundToTickMin = false; dateTimeScale.RoundToTickMax = false; dateTimeScale.EnableUnitSensitiveFormatting = false; dateTimeScale.LabelValueFormatter = new NDateTimeValueFormatter("T"); axis.ScaleConfigurator = dateTimeScale; // setup Y axis axis = chart.Axis(StandardAxis.PrimaryY); NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)axis.ScaleConfigurator; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, false); linearScale.InnerMajorTickStyle.Length = new NLength(0); NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.StripStyles.Add(stripStyle); // setup the line series NLineSeries line = (NLineSeries)chart.Series.Add(SeriesType.Line); line.Name = "Price"; line.Legend.Mode = SeriesLegendMode.None; line.DataLabelStyle.Visible = false; line.FillStyle = new NColorFillStyle(Color.RoyalBlue); line.UseXValues = true; }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Date Time Box and Whiskers"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); // remove the legend nChartControl1.Legends.Clear(); // setup the chart m_Chart = nChartControl1.Charts[0]; m_Chart.Axis(StandardAxis.Depth).Visible = false; NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; // add interlace stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Left }; linearScale.StripStyles.Add(stripStyle); NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale; NBoxAndWhiskersSeries series = (NBoxAndWhiskersSeries)m_Chart.Series.Add(SeriesType.BoxAndWhiskers); series.DataLabelStyle.Visible = false; series.UseXValues = true; series.FillStyle = new NGradientFillStyle(GradientStyle.Vertical, GradientVariant.Variant4, LightOrange, DarkOrange); series.MedianStrokeStyle = new NStrokeStyle(Color.Indigo); series.AverageStrokeStyle = new NStrokeStyle(1, Color.DarkRed, LinePattern.Dot); series.OutliersBorderStyle = new NStrokeStyle(DarkFuchsia); series.OutliersFillStyle = new NColorFillStyle(Red); GenerateData(series, 5); // apply layout ConfigureStandardLayout(m_Chart, title, null); BoxWidthScroll.Value = 40; WhiskersWidthScroll.Value = 50; RoundToTickCheck.Checked = true; InflateMarginsCheck.Checked = true; }
protected void Page_Load(object sender, System.EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("DateTime Step Line"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // no legend nChartControl1.Legends.Clear(); // setup chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; NLinearScaleConfigurator linearScaleConfigurator = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; // add interlaced stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); linearScaleConfigurator.StripStyles.Add(stripStyle); NDateTimeScaleConfigurator timeScaleConfigurator = new NDateTimeScaleConfigurator(); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = timeScaleConfigurator; timeScaleConfigurator.LabelGenerationMode = LabelGenerationMode.Stagger2; timeScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; timeScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); // setup step line series NStepLineSeries line = (NStepLineSeries)chart.Series.Add(SeriesType.StepLine); line.Name = "Step Line Series"; line.InflateMargins = true; line.UseXValues = true; line.UseZValues = false; line.Legend.Mode = SeriesLegendMode.None; line.DataLabelStyle.Visible = false; line.BorderStyle.Width = new NLength(2, NGraphicsUnit.Pixel); line.BorderStyle.Color = Color.YellowGreen; line.FillStyle = new NGradientFillStyle(GradientStyle.Vertical, GradientVariant.Variant2, Color.Green, Color.BlanchedAlmond); line.ShadowStyle.Type = ShadowType.Solid; line.ShadowStyle.Color = Color.FromArgb(15, 0, 0, 0); line.MarkerStyle.PointShape = PointShape.Cylinder; line.MarkerStyle.Width = new NLength(1.2f, NRelativeUnit.ParentPercentage); line.MarkerStyle.Height = new NLength(1.2f, NRelativeUnit.ParentPercentage); line.MarkerStyle.BorderStyle.Width = new NLength(2, NGraphicsUnit.Pixel); line.MarkerStyle.BorderStyle.Color = Color.YellowGreen; // generate some random data Random random = new Random(); int valuesCount = 10; GenreateYValues(valuesCount, random); GenreateXValues(valuesCount, random); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { LineStudyDropDownList.Items.Add("Fibonacci Arcs"); LineStudyDropDownList.Items.Add("Fibonacci Fans"); LineStudyDropDownList.Items.Add("Fibonacci Retracements"); LineStudyDropDownList.Items.Add("Speed Resistance Lines"); LineStudyDropDownList.Items.Add("Quadrant Lines"); LineStudyDropDownList.Items.Add("Trend Line"); WebExamplesUtilities.FillComboWithEnumValues(TrendlineModeDropDownList, typeof(TrendLineMode)); // form controls LineStudyDropDownList.SelectedIndex = 0; TrendlineModeDropDownList.SelectedIndex = 1; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = new NLabel(); title.Text = "Line Studies - " + LineStudyDropDownList.SelectedItem.Text; title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; nChartControl1.Panels.Add(title); // no legend nChartControl1.Legends.Clear(); // setup chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; // setup X axis NAxis axis = chart.Axis(StandardAxis.PrimaryX); NDateTimeScaleConfigurator timeScaleConfigurator = new NDateTimeScaleConfigurator(); axis.ScaleConfigurator = timeScaleConfigurator; timeScaleConfigurator.EnableUnitSensitiveFormatting = false; timeScaleConfigurator.LabelValueFormatter = new NDateTimeValueFormatter("MMM yy"); timeScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; timeScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); timeScaleConfigurator.InnerMajorTickStyle.LineStyle.Width = new NLength(0, NGraphicsUnit.Pixel); timeScaleConfigurator.RoundToTickMin = false; timeScaleConfigurator.RoundToTickMax = false; timeScaleConfigurator.LabelGenerationMode = LabelGenerationMode.SingleLevel; // setup Y axis 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); // add interlaced stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); linearScaleConfigurator.StripStyles.Add(stripStyle); 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.3f, 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.UseXValues = true; stock.InflateMargins = true; GenerateData(stock); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); // create line study NLineStudy lineStudy = null; Color lineColor = Color.Crimson; switch (LineStudyDropDownList.SelectedIndex) { case 0: lineStudy = new NFibonacciArcs(); break; case 1: lineStudy = new NFibonacciFans(); break; case 2: lineStudy = new NFibonacciRetracements(); ((NFibonacciRetracements)lineStudy).RetracementsStrokeStyle.Color = lineColor; break; case 3: lineStudy = new NSpeedResistanceLines(); break; case 4: lineStudy = new NQuadrantLines(); ((NQuadrantLines)lineStudy).CentralLineStrokeStyle.Color = lineColor; break; case 5: lineStudy = new NTrendLine(); break; default: return; } // attach the line study to the stock series lineStudy.BeginPoint = GetLowPointFromStock(stock, 20); lineStudy.EndPoint = GetHighPointFromStock(stock, 80); // set the primary line color lineStudy.StrokeStyle.Color = lineColor; InsertFinancialMarker(chart, lineStudy); TrendlineModeDropDownList.Enabled = lineStudy is NTrendLine; // set trend line mode NTrendLine trend = chart.Series[0] as NTrendLine; lineStudy.TrendLineMode = (TrendLineMode)TrendlineModeDropDownList.SelectedIndex; // set text visibility lineStudy.ShowTexts = ShowTextsCheckBox.Checked; }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = new NLabel("DateTime Float Bar"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // setup chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; // setup Y axis NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); // add interlaced stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); stripStyle.Interlaced = true; linearScale.StripStyles.Add(stripStyle); chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale; // setup x axis NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); dateTimeScale.LabelValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.Date); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale; // create the float bar series NFloatBarSeries floatBar = new NFloatBarSeries(); chart.Series.Add(floatBar); floatBar.UseXValues = true; floatBar.UseZValues = false; floatBar.InflateMargins = true; floatBar.DataLabelStyle.Visible = false; // bar appearance floatBar.BorderStyle.Color = Color.Bisque; floatBar.ShadowStyle.Type = ShadowType.Solid; floatBar.ShadowStyle.Color = Color.FromArgb(30, 0, 0, 0); floatBar.Values.ValueFormatter = new NNumericValueFormatter("0.00"); floatBar.EndValues.ValueFormatter = new NNumericValueFormatter("0.00"); // show the begin end values in the legend floatBar.Legend.Format = "<begin> - <end>"; floatBar.Legend.Mode = SeriesLegendMode.DataPoints; GenerateData(floatBar); // apply layout ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); }
public override void Initialize() { base.Initialize(); nChartControl1.Settings.ShapeRenderingMode = ShapeRenderingMode.None; nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); // set a chart title NLabel title = new NLabel("Rectilinear Grid Surface"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); // setup chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Width = 60.0f; chart.Depth = 30.0f; chart.Height = 2.0f; chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.SoftCameraLight); // setup axes NDateTimeScaleConfigurator scaleX = new NDateTimeScaleConfigurator(); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Back }; scaleX.InflateViewRangeBegin = false; scaleX.InflateViewRangeEnd = false; NLinearScaleConfigurator scaleZ = new NLinearScaleConfigurator(); chart.Axis(StandardAxis.Depth).ScaleConfigurator = scaleZ; scaleZ.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Left }; scaleZ.InflateViewRangeBegin = false; scaleZ.InflateViewRangeEnd = false; // add the surface series NGridSurfaceSeries surface = (NGridSurfaceSeries)chart.Series.Add(SeriesType.GridSurface); surface.Name = "Surface"; surface.PositionValue = 10.0; surface.SyncPaletteWithAxisScale = false; surface.PaletteSteps = 8; surface.ValueFormatter.FormatSpecifier = "0.000"; surface.FillMode = SurfaceFillMode.Uniform; surface.FrameMode = SurfaceFrameMode.Mesh; surface.ShadingMode = ShadingMode.Flat; surface.FillStyle = new NColorFillStyle(Color.FromArgb(190, 210, 230)); // specify that the surface should use custom X and Z values surface.XValuesMode = GridSurfaceValuesMode.CustomValues; surface.ZValuesMode = GridSurfaceValuesMode.CustomValues; surface.Data.SetGridSize(40, 20); GenerateXValues(surface); GenerateZValues(surface); FillData(surface); // apply layout ConfigureStandardLayout(chart, title, null); smoothShadingCheck.Checked = true; }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel header = nChartControl1.Labels.AddHeader("Date Time Scale"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL( new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); m_Chart = nChartControl1.Charts[0]; m_Chart.BoundsMode = BoundsMode.Stretch; // add a strip line style NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); NScaleStripStyle stripStyle = new NScaleStripStyle(); stripStyle.FillStyle = new NColorFillStyle(Color.Beige); stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); stripStyle.Interlaced = true; linearScale.StripStyles.Add(stripStyle); m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale; // create line serie and dispay them on vertical axis NLineSeries line1 = CreateLineSeries(Color.Red, Color.DarkRed); NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); m_DateTimeScale = dateTimeScale; m_DateTimeScale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.View, 90); m_DateTimeScale.LabelStyle.ContentAlignment = ContentAlignment.MiddleLeft; m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale; m_Chart.BoundsMode = BoundsMode.Stretch; m_Chart.Location = new NPointL( new NLength(5, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); m_Chart.Size = new NSizeL( new NLength(85, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage)); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); if (!IsPostBack) { //set the begin date to today; StartDateCalendar.SelectedDate = DateTime.Today; //set the end date to a date two years from now EndDateCalendar.VisibleDate = CultureInfo.CurrentCulture.Calendar.AddYears(StartDateCalendar.SelectedDate, 2); EndDateCalendar.SelectedDate = CultureInfo.CurrentCulture.Calendar.AddYears(StartDateCalendar.SelectedDate, 2); EnableUnitSensitiveFormattingCheckBox.Checked = true; } UpdateDateTimeScale(); UpdateTimeSpan(); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Date/Time Smooth Area"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // no legend nChartControl1.Legends.Clear(); // setup chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale; dateTimeScale.LabelValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.Date); dateTimeScale.LabelGenerationMode = LabelGenerationMode.Stagger2; NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); // add interlaced stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.StripStyles.Add(stripStyle); // add the area series NSmoothAreaSeries area = (NSmoothAreaSeries)chart.Series.Add(SeriesType.SmoothArea); area.DataLabelStyle.Visible = false; area.MarkerStyle.Visible = true; area.MarkerStyle.PointShape = PointShape.Cylinder; area.MarkerStyle.AutoDepth = false; area.MarkerStyle.Width = new NLength(1.4f, NRelativeUnit.ParentPercentage); area.MarkerStyle.Height = new NLength(1.4f, NRelativeUnit.ParentPercentage); area.MarkerStyle.Depth = new NLength(1.4f, NRelativeUnit.ParentPercentage); area.UseXValues = true; ShowMarkersCheck.Checked = true; RoundToTickCheck.Checked = true; ShowDropLinesCheck.Checked = false; AreaOriginModeCombo.FillFromEnum(typeof(SeriesOriginMode)); AreaOriginModeCombo.SelectedIndex = 0; OriginValueTextBox.Text = "0"; GenerateYValues(nValuesCount); GenerateXValues(nValuesCount); // apply layout ConfigureStandardLayout(chart, title, null); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { // set a chart title NLabel title = new NLabel("Gantt"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); // no legend nChartControl1.Legends.Clear(); // configure the chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; chart.Projection.ViewerRotation = 270; chart.Axis(StandardAxis.Depth).Visible = false; // setup the value axis NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); dateTimeScale.LabelValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.Date); 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.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)); // apply layout ConfigureStandardLayout(chart, title, null); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); }
private void NChartGridUC_Load(object sender, System.EventArgs e) { // set some background // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Built-in Grid Component"); 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)); // hide the legend ((NLegend)nChartControl1.Legends[0]).Mode = LegendMode.Disabled; // create two charts m_Chart1 = nChartControl1.Charts[0]; m_Chart1.Name = "Bar & Area Chart"; m_Chart2 = new NCartesianChart(); nChartControl1.Charts.Add(m_Chart2); m_Chart2.Name = "Line & Point Chart"; // position the charts using fit margin mode m_Chart1.BoundsMode = BoundsMode.Fit; m_Chart1.Location = new NPointL(new NLength(5, NRelativeUnit.ParentPercentage), new NLength(5, NRelativeUnit.ParentPercentage)); m_Chart1.Size = new NSizeL(new NLength(40, NRelativeUnit.ParentPercentage), new NLength(95, NRelativeUnit.ParentPercentage)); m_Chart2.BoundsMode = BoundsMode.Fit; m_Chart2.Location = new NPointL(new NLength(55, NRelativeUnit.ParentPercentage), new NLength(4, NRelativeUnit.ParentPercentage)); m_Chart2.Size = new NSizeL(new NLength(40, NRelativeUnit.ParentPercentage), new NLength(95, NRelativeUnit.ParentPercentage)); // second one is date time NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); m_Chart2.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale; // add series to first chart NBarSeries bar = (NBarSeries)m_Chart1.Series.Add(SeriesType.Bar); bar.Name = "Bar"; bar.DataLabelStyle.Visible = false; bar.Values.FillRandom(Random, 5); NAreaSeries area = (NAreaSeries)m_Chart1.Series.Add(SeriesType.Area); area.DataLabelStyle.Visible = false; area.FillStyle = new NColorFillStyle(Color.SkyBlue); area.Name = "Area"; area.Values.FillRandom(Random, 5); // add series to second chart NLineSeries line = (NLineSeries)m_Chart2.Series.Add(SeriesType.Line); line.DataLabelStyle.Visible = false; line.FillStyle = new NColorFillStyle(Color.DarkOrange); line.LineSegmentShape = LineSegmentShape.Tape; line.Name = "Line"; line.UseXValues = true; line.Values.FillRandom(Random, 3); line.XValues.Add(6); line.XValues.ValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.Date); for (int i = 1; i < 3; i++) { line.XValues.Add((double)line.XValues[i - 1] + Random.Next(5, 100)); } NPointSeries point = (NPointSeries)m_Chart2.Series.Add(SeriesType.Point); point.DataLabelStyle.Visible = false; point.PointShape = PointShape.Sphere; point.Name = "Point"; point.UseXValues = true; point.Values.FillRandom(Random, 3); point.XValues.Add(20); point.XValues.ValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.Date); for (int i = 1; i < 3; i++) { point.XValues.Add((double)point.XValues[i - 1] + Random.Next(5, 100)); } // bind the grid to the chart nChartGridControl1.ChartControl = nChartControl1; nChartControl1.InteractivityStyle.Tooltip.Text = "The background of the control"; nChartControl1.Controller.Tools.Clear(); nChartControl1.Controller.Tools.Add(new NTooltipTool()); ChartInteractivityComboBox.SelectedIndex = 0; }
void LoadBarChart() { if (nChartControl1.RequiresInitialization) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Legends.Clear(); // set a chart title NLabel header = nChartControl1.Labels.AddHeader("Total Web Site Hits per Day"); 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)); // setup a Bar chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = false; chart.BoundsMode = BoundsMode.Stretch; chart.Location = new NPointL( new NLength(4, NRelativeUnit.ParentPercentage), new NLength(25, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL( new NLength(88, NRelativeUnit.ParentPercentage), new NLength(75, NRelativeUnit.ParentPercentage)); // setup Y axis NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScale.InnerMajorTickStyle.Visible = false; // add interlace stripe to the Y axis NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(0xfe, 0xed, 0xe2)), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.StripStyles.Add(stripStyle); // setup X axis NDateTimeScaleConfigurator timeScale = new NDateTimeScaleConfigurator(); timeScale.EnableUnitSensitiveFormatting = true; timeScale.DateTimeUnitFormatterPairs.Clear(); timeScale.DateTimeUnitFormatterPairs.Add(new NDateTimeUnitFormatterPair(NDateTimeUnit.Day, new NDateTimeValueFormatter("d/MM/yy"))); timeScale.LabelFitModes = new LabelFitMode[] { LabelFitMode.AutoScale }; timeScale.MajorTickMode = MajorTickMode.CustomStep; timeScale.CustomStep = new NDateTimeSpan(1, NDateTimeUnit.Day); timeScale.InnerMajorTickStyle.Visible = false; timeScale.RoundToTickMin = false; timeScale.RoundToTickMax = false; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = timeScale; // setup bar series NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.Name = "Total Web Site Hits per Day"; bar.DataLabelStyle.Format = "<value>"; bar.DataLabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 8); bar.BarWidth = new NLength(10, NRelativeUnit.ParentPercentage); bar.InflateMargins = true; bar.UseXValues = true; bar.UseZValues = false; // initialize data points DateTime date = startDate; int lengthDays = hitsPerDayPerRegion.Length; for (int i = 0; i < lengthDays; i++) { int totalHits = 0; int lengthRegions = hitsPerDayPerRegion[i].Length; for (int j = 0; j < lengthRegions; j++) { totalHits += hitsPerDayPerRegion[i][j]; } bar.XValues.Add(date); bar.Values.Add(totalHits); if (i > 0) { bar.InteractivityStyles.Add(i, new NInteractivityStyle(true, i.ToString(), string.Format("{0}: {1}", date.ToString("dd/MMM/yyyy"), totalHits), CursorType.Hand)); } date = date.AddDays(1); } // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // select the first bar NChartPalette palette = new NChartPalette(ChartPredefinedPalette.Nevron); bar.FillStyles[0] = new NColorFillStyle(palette.SeriesColors[1]); } }
protected void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { HighLightRangeDropDownList.Items.Add("Weekdays"); HighLightRangeDropDownList.Items.Add("Weekends"); HighLightRangeDropDownList.SelectedIndex = 0; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel header = nChartControl1.Labels.AddHeader("Strip Lines"); 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)); // configure chart m_Chart = nChartControl1.Charts[0]; m_Chart.BoundsMode = BoundsMode.Stretch; m_Chart.Location = new NPointL( new NLength(2, NRelativeUnit.ParentPercentage), new NLength(13, NRelativeUnit.ParentPercentage)); m_Chart.Size = new NSizeL( new NLength(94, NRelativeUnit.ParentPercentage), new NLength(85, NRelativeUnit.ParentPercentage)); // Add a line series NLineSeries line = (NLineSeries)m_Chart.Series.Add(SeriesType.Line); line.UseXValues = true; line.BorderStyle.Color = Color.DarkRed; line.DataLabelStyle.Visible = false; line.InflateMargins = true; line.MarkerStyle.Visible = true; line.MarkerStyle.BorderStyle.Color = Color.DarkRed; line.MarkerStyle.FillStyle = new NColorFillStyle(Color.Red); line.MarkerStyle.PointShape = PointShape.Cylinder; line.MarkerStyle.Width = new NLength(2, NRelativeUnit.ParentPercentage); line.MarkerStyle.Height = new NLength(2, NRelativeUnit.ParentPercentage); line.Legend.Mode = SeriesLegendMode.None; // create a date time scale NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); dateTimeScale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.View, 90); dateTimeScale.LabelStyle.ContentAlignment = ContentAlignment.MiddleLeft; dateTimeScale.EnableUnitSensitiveFormatting = false; dateTimeScale.MajorTickMode = MajorTickMode.CustomStep; dateTimeScale.CustomStep = new NDateTimeSpan(1, NDateTimeUnit.Day); dateTimeScale.LabelValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.WeekDayShortName); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale; // create a strip line highlighting the working days NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(125, Color.Orange)), null, true, 0, 0, 2, 5); stripStyle.SetShowAtWall(ChartWallType.Back, true); NDateTimeRangeSamplerProvider provider = new NDateTimeRangeSamplerProvider(); provider.SamplingMode = SamplingMode.CustomStep; provider.UseOrigin = true; provider.Origin = new DateTime(2007, 2, 19); provider.CustomStep = new NDateTimeSpan(1, NDateTimeUnit.Day); stripStyle.RangeSamplerProvider = provider; // configure the x axis to use date time paging NDateTimeAxisPagingView dateTimePagingView = new NDateTimeAxisPagingView(DateTime.Now, new NDateTimeSpan(10, NDateTimeUnit.Day)); dateTimePagingView.Enabled = true; m_Chart.Axis(StandardAxis.PrimaryX).PagingView = dateTimePagingView; GenerateData(null, null); if (!Page.IsPostBack) { HighLightRangeDropDownList.SelectedIndex = 0; } UpdateHighlightRange(); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Strip Lines"); title.TextStyle.TextFormat = TextFormat.XML; title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // no legend nChartControl1.Legends.Clear(); // configure the chart m_Chart = nChartControl1.Charts[0]; m_Chart.BoundsMode = BoundsMode.Stretch; // Add a line series NLineSeries line = (NLineSeries)m_Chart.Series.Add(SeriesType.Line); line.UseXValues = true; line.BorderStyle.Color = Color.DarkRed; line.DataLabelStyle.Visible = false; line.InflateMargins = true; line.MarkerStyle.Visible = true; line.MarkerStyle.PointShape = PointShape.Cylinder; line.MarkerStyle.Width = new NLength(2, NRelativeUnit.ParentPercentage); line.MarkerStyle.Height = new NLength(2, NRelativeUnit.ParentPercentage); // create a date time scale NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); dateTimeScale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 90); dateTimeScale.LabelStyle.ContentAlignment = ContentAlignment.MiddleLeft; dateTimeScale.EnableUnitSensitiveFormatting = false; dateTimeScale.MajorTickMode = MajorTickMode.CustomStep; dateTimeScale.CustomStep = new NDateTimeSpan(1, NDateTimeUnit.Day); dateTimeScale.LabelValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.WeekDayShortName); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale; // create a strip line highlighting the working days NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 2, 5); stripStyle.SetShowAtWall(ChartWallType.Back, true); NDateTimeRangeSamplerProvider provider = new NDateTimeRangeSamplerProvider(); provider.SamplingMode = SamplingMode.CustomStep; provider.UseOrigin = true; provider.Origin = new DateTime(2007, 2, 19); provider.CustomStep = new NDateTimeSpan(1, NDateTimeUnit.Day); stripStyle.RangeSamplerProvider = provider; // configure the x axis to use date time paging NDateTimeAxisPagingView dateTimePagingView = new NDateTimeAxisPagingView(DateTime.Now, new NDateTimeSpan(10, NDateTimeUnit.Day)); dateTimePagingView.Enabled = true; m_Chart.Axis(StandardAxis.PrimaryX).PagingView = dateTimePagingView; m_Chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true; m_Chart.Axis(StandardAxis.PrimaryX).ScrollBar.ResetButton.Visible = false; nChartControl1.Controller.Tools.Add(new NAxisScrollTool()); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); HighLightRangeComboBox.Items.Add("Weekdays"); HighLightRangeComboBox.Items.Add("Weekends"); HighLightRangeComboBox.SelectedIndex = 0; GenerateData(null, null); }
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, System.EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Date/Time Smooth Area"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // no legend nChartControl1.Legends.Clear(); // setup chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale; dateTimeScale.LabelValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.Date); dateTimeScale.LabelGenerationMode = LabelGenerationMode.Stagger2; NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); // add interlace stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; linearScale.StripStyles.Add(stripStyle); // add the area series NSmoothAreaSeries area = (NSmoothAreaSeries)chart.Series.Add(SeriesType.SmoothArea); area.FillStyle = new NColorFillStyle(Color.LightSteelBlue); area.BorderStyle.Color = Color.MidnightBlue; area.DataLabelStyle.Visible = false; area.MarkerStyle.Visible = true; area.MarkerStyle.PointShape = PointShape.Cylinder; area.MarkerStyle.BorderStyle.Color = Color.MidnightBlue; area.MarkerStyle.AutoDepth = false; area.MarkerStyle.Width = new NLength(1.4f, NRelativeUnit.ParentPercentage); area.MarkerStyle.Height = new NLength(1.4f, NRelativeUnit.ParentPercentage); area.MarkerStyle.Depth = new NLength(1.4f, NRelativeUnit.ParentPercentage); area.UseXValues = true; GenreateYValues(nValuesCount); GenreateXValues(nValuesCount); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); if (!Page.IsPostBack) { ShowMarkersCheck.Checked = true; RoundToTickCheck.Checked = true; ShowDropLinesCheck.Checked = false; WebExamplesUtilities.FillComboWithEnumValues(AreaOriginModeCombo, typeof(SeriesOriginMode)); AreaOriginModeCombo.SelectedIndex = 0; OriginValueTextBox.Text = "0"; } area.MarkerStyle.Visible = ShowMarkersCheck.Checked; area.DropLines = ShowDropLinesCheck.Checked; area.OriginMode = (SeriesOriginMode)AreaOriginModeCombo.SelectedIndex; try { area.Origin = Double.Parse(OriginValueTextBox.Text); } catch { } dateTimeScale.RoundToTickMin = RoundToTickCheck.Checked; dateTimeScale.RoundToTickMax = RoundToTickCheck.Checked; linearScale.RoundToTickMin = RoundToTickCheck.Checked; linearScale.RoundToTickMax = RoundToTickCheck.Checked; }
private void IntitChart() { nChartControl1.Clear(); // 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; }
protected void Page_Load(object sender, System.EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Date Time Stack Float Bar"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // configure the chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; // setup X axis NDateTimeScaleConfigurator timeScaleConfigurator = new NDateTimeScaleConfigurator(); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = timeScaleConfigurator; // setup Y axis NLinearScaleConfigurator scaleY = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Left }; scaleY.StripStyles.Add(stripStyle); // setup the floatbar series NFloatBarSeries floatbar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar); floatbar.MultiFloatBarMode = MultiFloatBarMode.Series; floatbar.Name = "Floatbar"; floatbar.DataLabelStyle.Visible = false; floatbar.Legend.TextStyle.FontStyle.EmSize = new NLength(8); floatbar.UseXValues = true; floatbar.InflateMargins = true; // setup the bar series NBarSeries bar1 = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar1.Name = "Bar 1"; bar1.MultiBarMode = MultiBarMode.Stacked; bar1.DataLabelStyle.Visible = false; bar1.Legend.TextStyle.FontStyle.EmSize = new NLength(8); // setup the bar series NBarSeries bar2 = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar2.Name = "Bar 2"; bar2.MultiBarMode = MultiBarMode.Stacked; bar2.DataLabelStyle.Visible = false; bar2.Legend.TextStyle.FontStyle.EmSize = new NLength(8); if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(BarShapeDropDownList, typeof(BarShape)); BarShapeDropDownList.SelectedIndex = 0; DataTypeDropDownList.Items.Add("Positive Data"); DataTypeDropDownList.Items.Add("Positive and Negative Data"); DataTypeDropDownList.SelectedIndex = 0; } BarShape selectedShape = (BarShape)BarShapeDropDownList.SelectedIndex; floatbar.BarShape = selectedShape; bar1.BarShape = selectedShape; bar2.BarShape = selectedShape; GenerateXData(); if (DataTypeDropDownList.SelectedIndex == 0) { GeneratePosData(); } else { GeneratePosNegData(); } // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("DateTime Smooth Line"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // no legend nChartControl1.Legends.Clear(); // setup chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; // setup X axis NDateTimeScaleConfigurator scaleX = new NDateTimeScaleConfigurator(); scaleX.EnableUnitSensitiveFormatting = false; scaleX.LabelValueFormatter = new NDateTimeValueFormatter("dd MMM"); scaleX.LabelStyle.Angle = new NScaleLabelAngle(90); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // setup Y axis NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; // add interlace stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleY.StripStyles.Add(stripStyle); // add the line NSmoothLineSeries line = (NSmoothLineSeries)chart.Series.Add(SeriesType.SmoothLine); line.Name = "Smooth Line"; line.InflateMargins = true; line.DataLabelStyle.Visible = false; line.MarkerStyle.Visible = true; line.MarkerStyle.PointShape = PointShape.Cylinder; line.MarkerStyle.AutoDepth = false; line.MarkerStyle.Width = new NLength(1.4f, NRelativeUnit.ParentPercentage); line.MarkerStyle.Height = new NLength(1.4f, NRelativeUnit.ParentPercentage); line.MarkerStyle.Depth = new NLength(1.4f, NRelativeUnit.ParentPercentage); line.UseXValues = true; line.UseZValues = false; line.Use1DInterpolationForXYScatter = true; // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); GenreateYValues(nValuesCount); GenreateXValues(nValuesCount); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
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); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Date Time Scale"); title.TextStyle.TextFormat = TextFormat.XML; title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // no legend nChartControl1.Legends.Clear(); // setup chart m_Chart = (NCartesianChart)nChartControl1.Charts[0]; m_Chart.BoundsMode = BoundsMode.Stretch; // add a range selection, snapped to the vertical axis min/max values NRangeSelection rangeSelection = new NRangeSelection(); rangeSelection.VerticalValueSnapper = new NAxisRulerMinMaxSnapper(); m_Chart.RangeSelections.Add(rangeSelection); // add interlaced stripe to the Y axis NLinearScaleConfigurator linearScale = m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.StripStyles.Add(stripStyle); // Add a line series NLineSeries line = (NLineSeries)m_Chart.Series.Add(SeriesType.Line); line.UseXValues = true; line.DataLabelStyle.Visible = false; line.InflateMargins = true; line.MarkerStyle.Visible = true; line.MarkerStyle.BorderStyle.Color = Color.DarkRed; line.MarkerStyle.PointShape = PointShape.Cylinder; line.MarkerStyle.Width = new NLength(2, NRelativeUnit.ParentPercentage); line.MarkerStyle.Height = new NLength(2, NRelativeUnit.ParentPercentage); // create a date time scale NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); m_DateTimeScale = dateTimeScale; m_DateTimeScale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 90); m_DateTimeScale.LabelStyle.ContentAlignment = ContentAlignment.MiddleLeft; m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale; // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); NAxis xAxis = m_Chart.Axis(StandardAxis.PrimaryX); xAxis.ScrollBar.Visible = true; // configure interactivity nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NAxisScrollTool()); nChartControl1.Controller.Tools.Add(new NDataZoomTool()); // init form controls EndDateTimePicker.Value = CultureInfo.CurrentCulture.Calendar.AddYears(StartDateTimePicker.Value, 2); EnableUnitSensitiveFormattingCheckBox.Checked = true; DayCheckBox.Checked = true; WeekCheckBox.Checked = true; MonthCheckBox.Checked = true; QuarterCheckBox.Checked = true; YearCheckBox.Checked = true; UpdateDateTimeScale(); GenerateDataButton_Click(null, null); nChartControl1.Refresh(); }
protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithValues(BoxWidthDropDownList, 0, 100, 10); BoxWidthDropDownList.SelectedIndex = 7; WebExamplesUtilities.FillComboWithValues(WhiskersWidthDropDownList, 0, 100, 10); WhiskersWidthDropDownList.SelectedIndex = 5; LeftAxisRoundToTickCheckBox.Checked = true; InflateMarginsCheckBox.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Date Time Box and Whiskers"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // no legend nChartControl1.Legends.Clear(); // setup chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; // add interlaced stripe NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; scaleY.RoundToTickMin = LeftAxisRoundToTickCheckBox.Checked; scaleY.RoundToTickMax = LeftAxisRoundToTickCheckBox.Checked; NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); scaleY.StripStyles.Add(stripStyle); NDateTimeScaleConfigurator timeScale = new NDateTimeScaleConfigurator(); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = timeScale; timeScale.LabelGenerationMode = LabelGenerationMode.SingleLevel; timeScale.EnableUnitSensitiveFormatting = false; timeScale.LabelValueFormatter = new NDateTimeValueFormatter("dd MMM"); timeScale.LabelFitModes = new LabelFitMode[] { LabelFitMode.Rotate90 }; // setup series NBoxAndWhiskersSeries series = (NBoxAndWhiskersSeries)chart.Series.Add(SeriesType.BoxAndWhiskers); series.DataLabelStyle.Visible = false; series.UseXValues = true; series.FillStyle = new NGradientFillStyle(GradientStyle.Vertical, GradientVariant.Variant4, Red, DarkOrange); series.OutliersSize = new NLength(1.4f, NRelativeUnit.ParentPercentage); series.OutliersBorderStyle = new NStrokeStyle(GreyBlue); series.OutliersFillStyle = new NColorFillStyle(Red); series.MedianStrokeStyle = new NStrokeStyle(Color.Indigo); series.AverageStrokeStyle = new NStrokeStyle(1, Color.DarkRed, LinePattern.Dot); series.BoxWidth = new NLength(BoxWidthDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage); series.WhiskersWidthPercent = WhiskersWidthDropDownList.SelectedIndex * 10; series.InflateMargins = InflateMarginsCheckBox.Checked; GenerateData(series, 5); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = new NLabel("Date Time Stack Float Bar"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // setup chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; // add interlaced stripe NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); stripStyle.Interlaced = true; linearScale.StripStyles.Add(stripStyle); chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale; NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); dateTimeScale.LabelValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.Date); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale; // setup the floatbar series NFloatBarSeries floatbar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar); floatbar.MultiFloatBarMode = MultiFloatBarMode.Series; floatbar.Name = "Floatbar series"; floatbar.DataLabelStyle.Visible = false; floatbar.UseXValues = true; floatbar.InflateMargins = true; // setup the bar series NBarSeries bar1 = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar1.Name = "Bar series"; bar1.MultiBarMode = MultiBarMode.Stacked; bar1.DataLabelStyle.Visible = false; // setup the bar series NBarSeries bar2 = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar2.Name = "Bar series"; bar2.MultiBarMode = MultiBarMode.Stacked; bar2.DataLabelStyle.Visible = false; GeneratePosData(); GenerateXData(); // apply layout ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // init form controls BarShapeCombo.FillFromEnum(typeof(BarShape)); BarShapeCombo.SelectedIndex = 0; }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = new NLabel("DateTime Smooth Line"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // no legend nChartControl1.Legends.Clear(); // setup chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale; dateTimeScale.LabelValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.Date); dateTimeScale.LabelGenerationMode = LabelGenerationMode.Stagger2; NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); // add interlaced stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.StripStyles.Add(stripStyle); // add the line NSmoothLineSeries line = (NSmoothLineSeries)chart.Series.Add(SeriesType.SmoothLine); line.Name = "Smooth Line"; line.InflateMargins = true; line.Legend.Mode = SeriesLegendMode.Series; line.DataLabelStyle.Visible = false; line.MarkerStyle.Visible = true; line.MarkerStyle.PointShape = PointShape.Cylinder; line.MarkerStyle.AutoDepth = false; line.MarkerStyle.Width = new NLength(1.4f, NRelativeUnit.ParentPercentage); line.MarkerStyle.Height = new NLength(1.4f, NRelativeUnit.ParentPercentage); line.MarkerStyle.Depth = new NLength(1.4f, NRelativeUnit.ParentPercentage); line.UseXValues = true; line.UseZValues = false; line.Use1DInterpolationForXYScatter = true; checkShowMarkers.Checked = true; checkRoundToTick.Checked = true; GenerateYValues(nValuesCount); GenerateXValues(nValuesCount); // apply layout ConfigureStandardLayout(chart, title, null); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); }