private void BarShapeCombo_SelectedIndexChanged(object sender, System.EventArgs e) { NFloatBarSeries floatbar = (NFloatBarSeries)nChartControl1.Charts[0].Series[0]; NBarSeries bar1 = (NBarSeries)nChartControl1.Charts[0].Series[1]; NBarSeries bar2 = (NBarSeries)nChartControl1.Charts[0].Series[2]; BarShape selectedShape = (BarShape)BarShapeCombo.SelectedIndex; floatbar.BarShape = selectedShape; bar1.BarShape = selectedShape; bar2.BarShape = selectedShape; nChartControl1.Refresh(); }
/// <summary> /// 更新数据到图像 /// </summary> /// <param name="obj"></param> public void UpdateDataToGraphMinute(List <SecurityData> list, SecurityData latestData, bool clear) { if (clear) { DataSource.Clear(); } System.Drawing.Color color = System.Drawing.Color.SkyBlue; BarShape barVolume = GetShape("成交量") as BarShape; for (int i = 0; i < list.Count; i++) { SecurityData data = list[i]; if (latestData != null) { if (data.date > latestData.date) { continue; } } bool isFirst = i == 0; double date = data.date; if (latestData == null) { DataSource.Set(date, COLUMN_VOLUME, double.NaN); DataSource.Set(date, COLUMN_CLOSE, double.NaN); } else { DataSource.Set(date, COLUMN_VOLUME, data.volume); DataSource.Set(date, COLUMN_CLOSE, data.close); } if (isFirst) { LastClose = data.open; if (latestData == null) { DataSource.Set(date, COLUMN_VOLUME, LastClose); DataSource.Set(date, COLUMN_CLOSE, LastClose); } } } int indicatorsSize = indicators.Count; for (int i = 0; i < indicatorsSize; i++) { indicators[i].OnCalculate(0); } RefreshGraph(); }
private void Select(HandyButton button) { var currentActive = Items.Cast <HandyButton>().FirstOrDefault(b => b.Selected); if (currentActive != null) { currentActive.Selected = false; } button.Selected = true; var x = button.X + button.Width * .5 - (ThePath.Width * .5); BarShape.TranslateTo(x, ThePath.Y, 480U, Easing.CubicOut); }
/// <summary> /// 更新数据到图像 /// </summary> /// <param name="obj"></param> public void UpdateDataToGraph(List <SecurityData> list, bool clear) { if (clear) { DataSource.Clear(); } BarShape barVolume = GetShape("成交量") as BarShape; CandleShape candleShape = GetShape("K线") as CandleShape; int startIndex = DataSource.RowsCount; if (startIndex < 0) { startIndex = 0; } for (int i = 0; i < list.Count; i++) { SecurityData data = list[i]; if (!double.IsNaN(data.close)) { DataSource.Set(data.date, COLUMN_VOLUME, data.volume); int index = DataSource.GetRowIndex(data.date); DataSource.Set2(index, COLUMN_OPEN, data.open); DataSource.Set2(index, COLUMN_HIGH, data.high); DataSource.Set2(index, COLUMN_LOW, data.low); DataSource.Set2(index, COLUMN_CLOSE, data.close); if (data.open > data.close) { DataSource.Set2(index, barVolume.StyleField, 0); DataSource.Set2(index, candleShape.StyleField, 0); DataSource.Set2(index, barVolume.ColorField, System.Drawing.Color.FromArgb(80, 255, 255).ToArgb()); } else { DataSource.Set2(index, barVolume.StyleField, 1); DataSource.Set2(index, candleShape.StyleField, 1); DataSource.Set2(index, barVolume.ColorField, System.Drawing.Color.FromArgb(255, 80, 80).ToArgb()); } } } int indicatorsSize = indicators.Count; for (int i = 0; i < indicatorsSize; i++) { indicators[i].OnCalculate(startIndex); } RefreshGraph(); }
/// <summary> /// 更新数据到图像 /// </summary> /// <param name="obj"></param> public void UpdateDataToGraphMinute(List <SecurityData> list, bool empty) { System.Drawing.Color color = System.Drawing.Color.SkyBlue; BarShape barVolume = GetShape("成交量") as BarShape; int endIndex = list.Count; if (!empty) { endIndex = minuteDatasPos; } for (int i = 0; i < endIndex; i++) { SecurityData data = list[i]; bool isFirst = i == 0; double date = data.date; if (empty) { DataSource.Set(date, COLUMN_VOLUME, double.NaN); DataSource.Set(date, COLUMN_CLOSE, double.NaN); } else { DataSource.Set(date, COLUMN_VOLUME, data.volume); DataSource.Set(date, COLUMN_CLOSE, data.close); } if (isFirst) { LastClose = data.open; if (empty) { DataSource.Set(date, COLUMN_VOLUME, LastClose); DataSource.Set(date, COLUMN_CLOSE, LastClose); } } } int indicatorsSize = indicators.Count; for (int i = 0; i < indicatorsSize; i++) { indicators[i].OnCalculate(0); } RefreshGraph(); }
/// <summary> /// 初始化控件 /// </summary> public void InitControl() { indicators.Clear(); RemoveAll(); if (minuteMode) { AllowDrag = false; DataSource.SetColsCapacity(20); IsMinute = true; AutoFillXScale = true; ScrollAddSpeed = true; XFieldText = "日期"; CanMoveShape = true; LeftYScaleWidth = 80; RightYScaleWidth = 80; XScalePixel = 21; mainDiv = AddChartDiv(70); mainDiv.ShowVGrid = true; MinuteLineMax = 0; MinuteLineMin = 0; mainDiv.LeftYScale.ScaleType = YScaleType.EqualRatio; mainDiv.RightYScale.ScaleType = YScaleType.EqualRatio; mainDiv.Title = "分时线"; mainDiv.XScale.Visible = false; List <double> scaleSteps = new List <double>(); scaleSteps.Add(LbCommon.GetDateNum(1970, 1, 1, 10, 0, 0, 0)); scaleSteps.Add(LbCommon.GetDateNum(1970, 1, 1, 10, 30, 0, 0)); scaleSteps.Add(LbCommon.GetDateNum(1970, 1, 1, 11, 0, 0, 0)); scaleSteps.Add(LbCommon.GetDateNum(1970, 1, 1, 11, 30, 0, 0)); scaleSteps.Add(LbCommon.GetDateNum(1970, 1, 1, 13, 30, 0, 0)); scaleSteps.Add(LbCommon.GetDateNum(1970, 1, 1, 14, 0, 0, 0)); scaleSteps.Add(LbCommon.GetDateNum(1970, 1, 1, 14, 30, 0, 0)); mainDiv.XScale.ScaleSteps = scaleSteps; mainDiv.PaddingBottom = 10; mainDiv.PaddingTop = 10; LineShape lineShape = AddLine("分时线", COLUMN_CLOSE, mainDiv); lineShape.LineColor = Color.White; //成交量 volumeDiv = AddChartDiv(30); volumeDiv.LeftYScale.Distance = 60; volumeDiv.Title = "成交量"; volumeDiv.RightYScale.Distance = 60; volumeDiv.XScale.ScaleSteps = scaleSteps; BarShape barShape = AddBar("成交量", COLUMN_VOLUME, volumeDiv); volumeDiv.XScale.Format = "hh:mm"; barShape.Title = ""; barShape.BarStyle = BarStyle.Line; SetBar("成交量", System.Drawing.Color.FromArgb(255, 255, 80), System.Drawing.Color.FromArgb(255, 255, 80)); if (!Program.BlackOrWhite) { mainDiv.ForeColor = Color.Black; mainDiv.BackColor = Color.White; mainDiv.LeftYScale.TipForeColor = Color.White; mainDiv.RightYScale.TipForeColor = Color.White; volumeDiv.LeftYScale.TipForeColor = Color.White; volumeDiv.RightYScale.TipForeColor = Color.White; volumeDiv.XScale.TipForeColor = Color.White; volumeDiv.BackColor = Color.White; mainDiv.BorderColor = Color.Black; volumeDiv.BorderColor = Color.Black; macdDiv.BorderColor = Color.Black; mainDiv.LeftYScale.ForeColor = Color.Black; mainDiv.RightYScale.ForeColor = Color.Black; mainDiv.LeftYScale.ScaleColor = Color.Black; mainDiv.RightYScale.ScaleColor = Color.Black; volumeDiv.LeftYScale.ForeColor = Color.Black; volumeDiv.RightYScale.ForeColor = Color.Black; volumeDiv.LeftYScale.ScaleColor = Color.Black; volumeDiv.RightYScale.ScaleColor = Color.Black; mainDiv.GridColor = Color.Black; volumeDiv.GridColor = Color.Black; lineShape.LineColor = Color.Black; barShape.UpColor = Color.Black; barShape.DownColor = Color.Black; volumeDiv.XScale.ForeColor = Color.Black; volumeDiv.XScale.ScaleColor = Color.Black; } } else { AllowDrag = true; DataSource.SetColsCapacity(20); IsMinute = false; AutoFillXScale = false; ScrollAddSpeed = true; XFieldText = "日期"; CanMoveShape = true; LeftYScaleWidth = 80; RightYScaleWidth = 80; XScalePixel = 11; mainDiv = AddChartDiv(60); mainDiv.Title = "日线"; mainDiv.XScale.Visible = false; mainDiv.PaddingBottom = 10; mainDiv.PaddingTop = 10; //mainDiv.LeftYScale.System = VScaleSystem.Logarithmic; mainDiv.RightYScale.ScaleType = YScaleType.Percent; CandleShape candleShape = AddCandle("K线", COLUMN_OPEN, COLUMN_HIGH, COLUMN_LOW, COLUMN_CLOSE, mainDiv); candleShape.UpColor = Color.FromArgb(255, 80, 80); candleShape.DownColor = Color.FromArgb(80, 255, 255); candleShape.CandleStyle = CandleStyle.CloseLine; candleShape.StyleField = CTableEx.AutoField; candleShape.ColorField = CTableEx.AutoField; dataSource.AddColumn(candleShape.StyleField); dataSource.AddColumn(candleShape.ColorField); IndicatorMovingAverage indBoll = (IndicatorMovingAverage)AddIndicator("MA"); indBoll.SetParam(COLUMN_CLOSE, mainDiv); //成交量 volumeDiv = AddChartDiv(15); volumeDiv.XScale.Visible = false; volumeDiv.LeftYScale.Magnitude = 10000; volumeDiv.RightYScale.Magnitude = 10000; volumeDiv.LeftYScale.Digit = 0; volumeDiv.RightYScale.Digit = 0; BarShape barShape = AddBar("成交量", COLUMN_VOLUME, volumeDiv); barShape.Title = "成交量"; barShape.BarStyle = BarStyle.Bar; barShape.Digit = 0; barShape.StyleField = CTableEx.AutoField; barShape.ColorField = CTableEx.AutoField; dataSource.AddColumn(barShape.StyleField); dataSource.AddColumn(barShape.ColorField); SetBar("成交量", System.Drawing.Color.FromArgb(255, 255, 80), System.Drawing.Color.FromArgb(125, 206, 235)); macdDiv = AddChartDiv(25); macdDiv.XScale.Format = "hh:mm"; div2Indicator = ChangeIndicator(indicatorName); indicators.Add(indBoll); indicators.Add(div2Indicator); if (!Program.BlackOrWhite) { mainDiv.LeftYScale.TipForeColor = Color.White; mainDiv.RightYScale.TipForeColor = Color.White; volumeDiv.LeftYScale.TipForeColor = Color.White; volumeDiv.RightYScale.TipForeColor = Color.White; mainDiv.ForeColor = Color.Black; mainDiv.BackColor = Color.White; volumeDiv.BackColor = Color.White; macdDiv.BackColor = Color.White; mainDiv.BorderColor = Color.Black; volumeDiv.BorderColor = Color.Black; macdDiv.BorderColor = Color.Black; mainDiv.LeftYScale.ForeColor = Color.Black; mainDiv.RightYScale.ForeColor = Color.Black; mainDiv.LeftYScale.ScaleColor = Color.Black; mainDiv.RightYScale.ScaleColor = Color.Black; volumeDiv.LeftYScale.ForeColor = Color.Black; volumeDiv.RightYScale.ForeColor = Color.Black; volumeDiv.LeftYScale.ScaleColor = Color.Black; volumeDiv.RightYScale.ScaleColor = Color.Black; macdDiv.LeftYScale.ForeColor = Color.Black; macdDiv.RightYScale.ForeColor = Color.Black; macdDiv.LeftYScale.ScaleColor = Color.Black; macdDiv.RightYScale.ScaleColor = Color.Black; macdDiv.XScale.ForeColor = Color.Black; macdDiv.XScale.ScaleColor = Color.Black; mainDiv.GridColor = Color.Black; volumeDiv.GridColor = Color.Black; macdDiv.GridColor = Color.Black; candleShape.UpColor = Color.Black; candleShape.DownColor = Color.Black; barShape.UpColor = Color.Black; barShape.DownColor = Color.Black; candleShape.HighTitleColor = Color.Black; candleShape.LowTitleColor = Color.Black; candleShape.CloseTitleColor = Color.Black; candleShape.OpenTitleColor = Color.Black; List <BaseShape> shapes = indBoll.GetShapeList(); for (int i = 0; i < shapes.Count; i++) { BaseShape bShape = shapes[i] as BaseShape; if (bShape is BarShape) { (bShape as BarShape).DownColor = Color.Black; (bShape as BarShape).UpColor = Color.Black; } else if (bShape is LineShape) { (bShape as LineShape).LineColor = Color.Black; } } } } }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.Settings.JitterMode = JitterMode.Enabled; nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Stacked Bar Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // setup chart nChart = nChartControl1.Charts[0]; nChart.Enable3D = true; nChart.Axis(StandardAxis.Depth).Visible = false; nChart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); nChart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); // add interlace stripe NLinearScaleConfigurator scaleY = nChart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Left }; stripStyle.SetShowAtWall(ChartWallType.Left, true); scaleY.StripStyles.Add(stripStyle); // add the first bar nBar1 = (NBarSeries)nChart.Series.Add(SeriesType.Bar); nBar1.Name = "Bar1"; nBar1.MultiBarMode = MultiBarMode.Series; nBar1.DataLabelStyle.VertAlign = VertAlign.Center; nBar1.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(7); nBar1.Legend.TextStyle.FontStyle.EmSize = new NLength(8); nBar1.Values.ValueFormatter = new NNumericValueFormatter("0"); // add the second bar nBar2 = (NBarSeries)nChart.Series.Add(SeriesType.Bar); nBar2.Name = "Bar2"; nBar2.MultiBarMode = MultiBarMode.Stacked; nBar2.DataLabelStyle.VertAlign = VertAlign.Center; nBar2.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(7); nBar2.Legend.TextStyle.FontStyle.EmSize = new NLength(8); nBar2.Values.ValueFormatter = new NNumericValueFormatter("0"); // add the third bar nBar3 = (NBarSeries)nChart.Series.Add(SeriesType.Bar); nBar3.Name = "Bar3"; nBar3.MultiBarMode = MultiBarMode.Stacked; nBar3.DataLabelStyle.VertAlign = VertAlign.Center; nBar3.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(7); nBar3.Legend.TextStyle.FontStyle.EmSize = new NLength(8); nBar3.Values.ValueFormatter = new NNumericValueFormatter("0"); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // apply layout ApplyLayoutTemplate(0, nChartControl1, nChart, title, nChartControl1.Legends[0]); if (!IsPostBack) { // fill the data labels combos FirstBarLabelsDropDownList.Items.Add("Value"); FirstBarLabelsDropDownList.Items.Add("Total"); FirstBarLabelsDropDownList.Items.Add("Cumulative"); FirstBarLabelsDropDownList.Items.Add("Percent"); FirstBarLabelsDropDownList.Items.Add("No Label"); FirstBarLabelsDropDownList.SelectedIndex = 0; SecondBarLabelsDropDownList.Items.Add("Value"); SecondBarLabelsDropDownList.Items.Add("Total"); SecondBarLabelsDropDownList.Items.Add("Cumulative"); SecondBarLabelsDropDownList.Items.Add("Percent"); SecondBarLabelsDropDownList.Items.Add("No Label"); SecondBarLabelsDropDownList.SelectedIndex = 0; ThirdBarLabelsDropDownList.Items.Add("Value"); ThirdBarLabelsDropDownList.Items.Add("Total"); ThirdBarLabelsDropDownList.Items.Add("Cumulative"); ThirdBarLabelsDropDownList.Items.Add("Percent"); ThirdBarLabelsDropDownList.Items.Add("No Label"); ThirdBarLabelsDropDownList.SelectedIndex = 0; StackStyleDropDownList.Items.Add("Stacked"); StackStyleDropDownList.Items.Add("Stacked %"); StackStyleDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithEnumValues(BarShapeDropDownList, typeof(BarShape)); BarShapeDropDownList.SelectedIndex = 0; PositiveDataCheckBox.Checked = true; } nBar1.DataLabelStyle.Format = GetDataLabelsFormatString(FirstBarLabelsDropDownList); nBar2.DataLabelStyle.Format = GetDataLabelsFormatString(SecondBarLabelsDropDownList); nBar3.DataLabelStyle.Format = GetDataLabelsFormatString(ThirdBarLabelsDropDownList); switch (StackStyleDropDownList.SelectedIndex) { case 0: nBar2.MultiBarMode = MultiBarMode.Stacked; nBar3.MultiBarMode = MultiBarMode.Stacked; break; case 1: nBar2.MultiBarMode = MultiBarMode.StackedPercent; nBar3.MultiBarMode = MultiBarMode.StackedPercent; scaleY.LabelValueFormatter = new NNumericValueFormatter(NumericValueFormat.Percentage); break; } BarShape shape = (BarShape)BarShapeDropDownList.SelectedIndex; nBar1.BarShape = shape; nBar2.BarShape = shape; nBar3.BarShape = shape; bool bEnable = (shape.Equals(BarShape.SmoothEdgeBar)) || (shape.Equals(BarShape.CutEdgeBar)); ArrayList arrControls = new ArrayList(); arrControls.Add(FirstHasTopEdgeCheckBox); arrControls.Add(FirstHasBottomEdgeCheckBox); arrControls.Add(SecondHasTopEdgeCheckBox); arrControls.Add(SecondHasBottomEdgeCheckBox); arrControls.Add(ThirdHasTopEdgeCheckBox); arrControls.Add(ThirdHasBottomEdgeCheckBox); foreach (CheckBox check in arrControls) { check.Enabled = bEnable; } if (bEnable) { nBar1.HasTopEdge = FirstHasTopEdgeCheckBox.Checked; nBar1.HasBottomEdge = FirstHasBottomEdgeCheckBox.Checked; nBar2.HasTopEdge = SecondHasTopEdgeCheckBox.Checked; nBar2.HasBottomEdge = SecondHasBottomEdgeCheckBox.Checked; nBar3.HasTopEdge = ThirdHasTopEdgeCheckBox.Checked; nBar3.HasBottomEdge = ThirdHasBottomEdgeCheckBox.Checked; } if (PositiveDataCheckBox.Checked) { GeneratePositiveData(); } else { GeneratePositiveAndNegativeData(); } this.PositiveDataButton.Click += new EventHandler(this.PositiveDataButton_Click); this.PositivAndNegativeDataButton.Click += new EventHandler(this.PositiveAndNegativeDataButton_Click); }
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, System.EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Stack Float Bar"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // configure the chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Axis(StandardAxis.Depth).Visible = false; chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); // setup X axis NOrdinalScaleConfigurator scaleX = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; scaleX.MajorTickMode = MajorTickMode.AutoMaxCount; // add interlaced stripe to the Y axis NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Left }; scaleY.StripStyles.Add(stripStyle); // setup the floatbar series NFloatBarSeries floatbar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar); floatbar.MultiFloatBarMode = MultiFloatBarMode.Series; floatbar.Name = "Floatbar"; floatbar.FillStyle = new NColorFillStyle(Color.SandyBrown); floatbar.DataLabelStyle.Visible = false; // setup the bar series NBarSeries bar1 = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar1.Name = "Bar 1"; bar1.MultiBarMode = MultiBarMode.Stacked; bar1.FillStyle = new NColorFillStyle(Color.Green); bar1.DataLabelStyle.Visible = false; // setup the bar series NBarSeries bar2 = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar2.Name = "Bar 2"; bar2.MultiBarMode = MultiBarMode.Stacked; bar2.FillStyle = new NColorFillStyle(Color.CornflowerBlue); bar2.DataLabelStyle.Visible = false; if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(BarShapeDropDownList, typeof(BarShape)); BarShapeDropDownList.SelectedIndex = 0; DataTypeDropDownList.Items.Add("Positive Data"); DataTypeDropDownList.Items.Add("Positive and Negative Data"); DataTypeDropDownList.SelectedIndex = 0; } BarShape selectedShape = (BarShape)BarShapeDropDownList.SelectedIndex; floatbar.BarShape = selectedShape; bar1.BarShape = selectedShape; bar2.BarShape = selectedShape; if (DataTypeDropDownList.SelectedIndex == 0) { GeneratePosData(); } else { GeneratePosNegData(); } // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); }