/// <summary> /// /// </summary> /// <param name="threeLineBreak"></param> private void GenerateData(NThreeLineBreakSeries threeLineBreak) { NStockDataGenerator dataGenerator = new NStockDataGenerator(new NRange(50, 350), 0.002, 2); dataGenerator.Reset(); DateTime dt = DateTime.Now; for (int i = 0; i < 100; i++) { threeLineBreak.DataPoints.Add(new NThreeLineBreakDataPoint(NDateTimeHelpers.ToOADate(dt), dataGenerator.GetNextValue())); dt = dt.AddDays(1); } }
private void GenerateData(NThreeLineBreakSeries threeLineBreak) { NStockDataGenerator dataGenerator = new NStockDataGenerator(new NRange1DD(50, 350), 0.002, 2); dataGenerator.Reset(); DateTime dt = new DateTime(2007, 1, 1); for (int i = 0; i < 100; i++) { threeLineBreak.Values.Add(dataGenerator.GetNextValue()); threeLineBreak.XValues.Add(dt); dt = dt.AddDays(1); } }
public override void Initialize() { base.Initialize(); // remove all legends nChartControl1.Legends.Clear(); // set a chart title NLabel title = new NLabel("Three Line Break"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); NChart chart = nChartControl1.Charts[0]; 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); scaleY.StripStyles.Add(stripStyle); // setup X axis NPriceScaleConfigurator priceConfigurator = new NPriceScaleConfigurator(); priceConfigurator.InnerMajorTickStyle.LineStyle.Width = new NLength(0); priceConfigurator.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = priceConfigurator; // setup line break series m_ThreeLineBreak = (NThreeLineBreakSeries)chart.Series.Add(SeriesType.ThreeLineBreak); m_ThreeLineBreak.UseXValues = true; GenerateData(m_ThreeLineBreak); // apply layout ConfigureStandardLayout(chart, title, null); BoxWidthPercentCombo.SelectedIndex = 2; LinesToBreakNumericUpDown.Value = 3; nChartControl1.MouseMove += new MouseEventHandler(nChartControl1_MouseMove); }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { // remove all legends nChartControl1.Legends.Clear(); // set a chart title NLabel title = new NLabel("Three Line Break"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); NChart chart = nChartControl1.Charts[0]; 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); scaleY.StripStyles.Add(stripStyle); // setup X axis NPriceScaleConfigurator priceConfigurator = new NPriceScaleConfigurator(); priceConfigurator.InnerMajorTickStyle.LineStyle.Width = new NLength(0); priceConfigurator.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = priceConfigurator; // setup line break series m_ThreeLineBreak = new NThreeLineBreakSeries(); chart.Series.Add(m_ThreeLineBreak); m_ThreeLineBreak.UseXValues = true; GenerateData(m_ThreeLineBreak); // apply layout ConfigureStandardLayout(chart, title, null); NExampleHelpers.FillComboWithValues(BarWidthPercentComboBox, 0, 100, 10); BarWidthPercentComboBox.SelectedIndex = 2; NExampleHelpers.FillComboWithValues(NumberOfLinesToBreakComboBox, 1, 10, 1); NumberOfLinesToBreakComboBox.SelectedIndex = 4; }
/// <summary> /// /// </summary> /// <returns></returns> protected override NWidget CreateExampleContent() { NChartView chartView = CreateCartesianChartView(); // configure title chartView.Surface.Titles[0].Text = "Three Line Break"; // configure chart NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0]; chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear); NLinearScale scaleY = (NLinearScale)chart.Axes[ENCartesianAxis.PrimaryY].Scale; // add interlace stripe NScaleStrip stripStyle = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; scaleY.Strips.Add(stripStyle); // setup X axis NPriceTimeScale priceScale = new NPriceTimeScale(); priceScale.InnerMajorTicks.Stroke = new NStroke(0.0, NColor.Black); chart.Axes[ENCartesianAxis.PrimaryX].Scale = priceScale; // setup line break series m_ThreeLineBreak = new NThreeLineBreakSeries(); m_ThreeLineBreak.UseXValues = true; chart.Series.Add(m_ThreeLineBreak); GenerateData(m_ThreeLineBreak); chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, false)); return(chartView); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { WebExamplesUtilities.FillComboWithColorNames(UpColorDropDownList, KnownColor.White); WebExamplesUtilities.FillComboWithColorNames(DownColorDropDownList, KnownColor.Black); BoxWidthDropDownList.Items.AddRange(new ListItem[] { new ListItem("50%"), new ListItem("75%"), new ListItem("100%") }); BoxWidthDropDownList.SelectedIndex = 2; WebExamplesUtilities.FillComboWithValues(NumberOfLinesDropDownList, 1, 4, 1); } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Three Line Break"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // no legend nChartControl1.Legends.Clear(); // configure the chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; // add interlaced stripe NLinearScaleConfigurator linearScaleConfigurator = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); linearScaleConfigurator.StripStyles.Add(stripStyle); // setup X axis NPriceScaleConfigurator priceConfigurator = new NPriceScaleConfigurator(); priceConfigurator.InnerMajorTickStyle.LineStyle.Width = new NLength(0); priceConfigurator.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = priceConfigurator; // setup line break series NThreeLineBreakSeries threeLineBreak = (NThreeLineBreakSeries)chart.Series.Add(SeriesType.ThreeLineBreak); threeLineBreak.UseXValues = true; threeLineBreak.UpFillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(UpColorDropDownList)); threeLineBreak.DownFillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(DownColorDropDownList)); threeLineBreak.NumberOfLinesToBreak = Convert.ToInt32(NumberOfLinesDropDownList.SelectedValue); switch (BoxWidthDropDownList.SelectedIndex) { case 0: threeLineBreak.BoxWidthPercent = 50; break; case 1: threeLineBreak.BoxWidthPercent = 75; break; case 2: threeLineBreak.BoxWidthPercent = 100; break; } GenerateData(threeLineBreak); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }