/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Bubble Palette"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); // configure the chart m_Chart = nChartControl1.Charts[0]; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); m_Chart.Axis(StandardAxis.Depth).Visible = false; NLinearScaleConfigurator linearScale = m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; linearScale.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.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.StripStyles.Add(stripStyle); NOrdinalScaleConfigurator ordinalScale = m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator; ordinalScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); // add a bubble series m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); m_Bubble.DataLabelStyle.VertAlign = VertAlign.Center; m_Bubble.DataLabelStyle.Visible = false; m_Bubble.Legend.Mode = SeriesLegendMode.DataPoints; m_Bubble.Legend.Format = "Size <size>, Value <value>"; m_Bubble.MinSize = new NLength(7.0f, NRelativeUnit.ParentPercentage); m_Bubble.MaxSize = new NLength(16.0f, NRelativeUnit.ParentPercentage); for (int i = 0; i < 10; i++) { m_Bubble.Values.Add(i); m_Bubble.Sizes.Add(i * 10 + 10); } m_Bubble.InflateMargins = true; NPalette palette = new NPalette(); palette.SmoothPalette = true; palette.Clear(); palette.Add(0, Color.Green); palette.Add(60, Color.Yellow); palette.Add(120, Color.Red); m_Bubble.Palette = palette; // apply layout ConfigureStandardLayout(m_Chart, title, nChartControl1.Legends[0]); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Area Palette"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // configure the chart m_Chart = nChartControl1.Charts[0]; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalHalf); m_Chart.Axis(StandardAxis.Depth).Visible = false; // add interlace stripe NAxis yAxis = m_Chart.Axis(StandardAxis.PrimaryY); NLinearScaleConfigurator linearScale = yAxis.ScaleConfigurator as NLinearScaleConfigurator; NScaleStripStyle strip = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); strip.Interlaced = true; //linearScale.Strips.Add(strip); // setup a area series m_Area = new NAreaSeries(); m_Area.InflateMargins = true; m_Area.DataLabelStyle.Visible = false; m_Area.BorderStyle.Width = new NLength(0); m_Area.Legend.Mode = SeriesLegendMode.None; NPalette palette = new NPalette(); palette.Clear(); palette.Mode = PaletteMode.Custom; palette.Add(0, Color.Green); palette.Add(60, Color.Yellow); palette.Add(120, Color.Red); m_Area.Palette = palette; m_AxisRange = new NRange1DD(0, 130); // limit the axis range to 0, 130 yAxis.View = new NRangeAxisView(m_AxisRange, true, true); m_Chart.Series.Add(m_Area); int indicatorCount = 10; m_IndicatorPhase = new double[indicatorCount]; // add some data to the area series for (int i = 0; i < indicatorCount; i++) { m_IndicatorPhase[i] = i * 30; m_Area.Values.Add(0); } SmoothPaletteCheckBox.Checked = true; timer1.Start(); }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { // set a chart title NLabel title = nChartControl1.Labels.AddHeader("High Low Palette"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); // configure the chart m_Chart = nChartControl1.Charts[0]; m_Chart.Enable3D = true; m_Chart.Axis(StandardAxis.Depth).Visible = false; // add a High-Low series m_HighLow = (NHighLowSeries)m_Chart.Series.Add(SeriesType.HighLow); m_HighLow.Legend.Mode = SeriesLegendMode.None; m_HighLow.DataLabelStyle.Visible = false; GenerateData(); NPalette palette = new NPalette(); palette.Clear(); palette.SmoothPalette = true; palette.Mode = PaletteMode.Custom; palette.Add(0, Color.Green); palette.Add(1.5, Color.Yellow); palette.Add(3, Color.Red); m_HighLow.Palette = palette; // apply layout ConfigureStandardLayout(m_Chart, title, nChartControl1.Legends[0]); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); SmoothPaletteCheckBox.IsChecked = true; Enable3DCheckBox.IsChecked = true; }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("High Low Palette"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); // configure the chart m_Chart = nChartControl1.Charts[0]; m_Chart.Axis(StandardAxis.Depth).Visible = false; // add a High-Low series m_HighLow = (NHighLowSeries)m_Chart.Series.Add(SeriesType.HighLow); m_HighLow.Legend.Mode = SeriesLegendMode.None; m_HighLow.DataLabelStyle.Visible = false; GenerateData(); NPalette palette = new NPalette(); palette.Clear(); palette.Mode = PaletteMode.Custom; palette.Add(0, Color.Green); palette.Add(1.5, Color.Yellow); palette.Add(3, Color.Red); m_HighLow.Palette = palette; // apply layout ConfigureStandardLayout(m_Chart, title, nChartControl1.Legends[0]); SmoothPaletteCheckBox.Checked = true; Enable3DCheckBox.Checked = true; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SmoothPaletteCheckBox.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Legends[0].Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Area Palette"); 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.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalHalf); chart.Axis(StandardAxis.Depth).Visible = false; // add interlace stripe NAxis yAxis = chart.Axis(StandardAxis.PrimaryY); NLinearScaleConfigurator linearScale = yAxis.ScaleConfigurator as NLinearScaleConfigurator; NScaleStripStyle strip = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); strip.Interlaced = true; strip.SetShowAtWall(ChartWallType.Back, true); linearScale.StripStyles.Add(strip); // setup a bar series NAreaSeries area = new NAreaSeries(); area.Name = "Area Series"; area.InflateMargins = true; area.UseXValues = false; area.DataLabelStyle.Visible = false; NPalette palette = new NPalette(); palette.Clear(); palette.Add(0, Color.Green); palette.Add(60, Color.Yellow); palette.Add(120, Color.Red); area.Palette = palette; chart.Series.Add(area); int indicatorCount = 18; // add some data to the bar series float degree2Rad = (float)(Math.PI / 180); for (int i = 0; i <= indicatorCount; i++) { area.Values.Add(Math.Sin(degree2Rad * i * 10) * 150.0); } area.Palette.SmoothPalette = SmoothPaletteCheckBox.Checked; // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("XY Smooth Area"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // no legends nChartControl1.Legends.Clear(); // setup chart m_Chart = nChartControl1.Charts[0]; m_Chart.Enable3D = true; m_Chart.Width = 65; m_Chart.Height = 40; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); m_Chart.Axis(StandardAxis.Depth).Visible = false; // setup axes NLinearScaleConfigurator linearScaleX = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScaleX; NLinearScaleConfigurator linearScaleY = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScaleY.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); // add interlaced stripe 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); linearScaleY.StripStyles.Add(stripStyle); // add the area series m_SmoothArea = new NSmoothAreaSeries(); m_Chart.Series.Add(m_SmoothArea); m_SmoothArea.DataLabelStyle.Visible = false; m_SmoothArea.MarkerStyle.Visible = false; m_SmoothArea.UseXValues = true; NPalette palette = new NPalette(); palette.Clear(); palette.Mode = PaletteMode.Custom; palette.Add(0, Color.Green); palette.Add(5, Color.Yellow); palette.Add(10, Color.Red); m_SmoothArea.Palette = palette; GenerateYValues(nValuesCount); GenerateXValues(nValuesCount); // apply layout ConfigureStandardLayout(m_Chart, title, null); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); SmoothPaletteCheckBox.Checked = true; Enable3DCheckBox.Checked = true; }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Bubble Scale"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // configure the chart m_Chart = nChartControl1.Charts[0]; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); m_Chart.Axis(StandardAxis.Depth).Visible = false; NLinearScaleConfigurator linearScale = m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; linearScale.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.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.StripStyles.Add(stripStyle); NOrdinalScaleConfigurator ordinalScale = m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator; ordinalScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); // add a bubble series m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); m_Bubble.DataLabelStyle.VertAlign = VertAlign.Center; m_Bubble.DataLabelStyle.Visible = false; m_Bubble.MinSize = new NLength(7.0f, NRelativeUnit.ParentPercentage); m_Bubble.MaxSize = new NLength(16.0f, NRelativeUnit.ParentPercentage); for (int i = 0; i < 10; i++) { m_Bubble.Values.Add(i); m_Bubble.Sizes.Add(i * 10 + 10); } m_Bubble.InflateMargins = true; NPalette palette = new NPalette(); palette.SmoothPalette = true; palette.Clear(); palette.Add(0, Color.Green); palette.Add(60, Color.Yellow); palette.Add(120, Color.Red); m_Bubble.Palette = palette; nChartControl1.Legends[0].Header.Text = "Bubble Size"; m_Bubble.Legend.Mode = SeriesLegendMode.SeriesLogic; m_Bubble.BubbleSizeScale.TextOffset = new NLength(0); m_Bubble.BubbleSizeScale.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Center; m_Bubble.BubbleSizeScale.Mode = BubbleSizeScaleMode.ConcentricDown; // apply layout ConfigureStandardLayout(m_Chart, title, nChartControl1.Legends[0]); BubbleScaleModeCombo.FillFromEnum(typeof(BubbleSizeScaleMode)); BubbleScaleModeCombo.SelectedIndex = (int)m_Bubble.BubbleSizeScale.Mode; TextOffsetNumericUpDown.Value = (decimal)m_Bubble.BubbleSizeScale.TextOffset.Value; TableCellOffsetNumericUpDown.Value = (decimal)m_Bubble.BubbleSizeScale.TableCellOffset.Value; BubbleScaleStepsUpDown.Value = (decimal)m_Bubble.BubbleSizeScale.Steps; RoundValuesCheckBox.Checked = m_Bubble.BubbleSizeScale.RoundValues; BubbleScaleModeCombo_SelectedIndexChanged(null, null); }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Bubble Palette"); 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.Enable3D = false; NLinearScaleConfigurator linearScale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; linearScale.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.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.StripStyles.Add(stripStyle); NOrdinalScaleConfigurator ordinalScale = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator; ordinalScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); // add a bubble series NBubbleSeries bubble = (NBubbleSeries)chart.Series.Add(SeriesType.Bubble); bubble.DataLabelStyle.VertAlign = VertAlign.Center; bubble.DataLabelStyle.Visible = false; bubble.Legend.Mode = SeriesLegendMode.DataPoints; bubble.Legend.Format = "<size>"; bubble.MinSize = new NLength(7.0f, NRelativeUnit.ParentPercentage); bubble.MaxSize = new NLength(16.0f, NRelativeUnit.ParentPercentage); for (int i = 0; i < 10; i++) { bubble.Values.Add(i); bubble.Sizes.Add(i * 10 + 10); } bubble.InflateMargins = true; NPalette palette = new NPalette(); palette.SmoothPalette = true; palette.Clear(); palette.Add(0, Color.Green); palette.Add(60, Color.Yellow); palette.Add(120, Color.Red); bubble.Palette = palette; // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SmoothPaletteCheckBox.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Legends[0].Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Float Bar Palette"); 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.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalHalf); chart.Axis(StandardAxis.Depth).Visible = false; // add interlace stripe NAxis yAxis = chart.Axis(StandardAxis.PrimaryY); NLinearScaleConfigurator linearScale = yAxis.ScaleConfigurator as NLinearScaleConfigurator; NScaleStripStyle strip = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); strip.Interlaced = true; strip.SetShowAtWall(ChartWallType.Back, true); linearScale.StripStyles.Add(strip); // add a High-Low series NHighLowSeries highLow = (NHighLowSeries)chart.Series.Add(SeriesType.HighLow); highLow.Legend.Mode = SeriesLegendMode.None; highLow.DataLabelStyle.Visible = false; highLow.ClearDataPoints(); for (int i = 0; i < 20; i++) { double d1 = Math.Log(i + 1) + 0.1 * Random.NextDouble(); double d2 = d1 + Math.Cos(0.33 * i) + 0.1 * Random.NextDouble(); highLow.HighValues.Add(d1); highLow.LowValues.Add(d2); } NPalette palette = new NPalette(); palette.Clear(); palette.Mode = PaletteMode.Custom; palette.Add(0, Color.Green); palette.Add(1.5, Color.Yellow); palette.Add(3, Color.Red); highLow.Palette = palette; highLow.Palette.SmoothPalette = SmoothPaletteCheckBox.Checked; // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Bar Palette"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); // configure the chart m_Chart = nChartControl1.Charts[0]; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalHalf); m_Chart.Axis(StandardAxis.Depth).Visible = false; // add interlace stripe NAxis yAxis = m_Chart.Axis(StandardAxis.PrimaryY); NLinearScaleConfigurator linearScale = yAxis.ScaleConfigurator as NLinearScaleConfigurator; NScaleStripStyle strip = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); strip.Interlaced = true; //linearScale.Strips.Add(strip); // setup a bar series m_Bar = new NBarSeries(); m_Bar.Name = "Bar Series"; m_Bar.InflateMargins = true; m_Bar.UseXValues = false; m_Bar.DataLabelStyle.Visible = false; NPalette palette = new NPalette(); palette.SmoothPalette = true; palette.Clear(); palette.Add(0, Color.Green); palette.Add(60, Color.Yellow); palette.Add(120, Color.Red); m_Bar.Palette = palette; m_AxisRange = new NRange1DD(0, 130); // limit the axis range to 0, 130 yAxis.View = new NRangeAxisView(m_AxisRange, true, true); m_Chart.Series.Add(m_Bar); int indicatorCount = 10; m_IndicatorPhase = new double[indicatorCount]; // add some data to the bar series for (int i = 0; i < indicatorCount; i++) { m_IndicatorPhase[i] = i * 30; m_Bar.Values.Add(0); } NExampleHelpers.FillComboWithEnumValues(BarPaletteModeComboBox, typeof(PaletteColorMode)); BarPaletteModeComboBox.SelectedIndex = (int)PaletteColorMode.Spread; SmoothPaletteCheckBox.IsChecked = true; m_Timer = new System.Windows.Threading.DispatcherTimer(); m_Timer.Tick += new EventHandler(OnTimerTick); m_Timer.Interval = new TimeSpan(0, 0, 0, 0, 50); m_Timer.Start(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumNames(PaletteModeDropDownList, typeof(PaletteColorMode)); PaletteModeDropDownList.SelectedIndex = (int)PaletteColorMode.Spread; SmoothPaletteCheckBox.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Legends[0].Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Bar Palette"); 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.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalHalf); chart.Axis(StandardAxis.Depth).Visible = false; // add interlace stripe NAxis yAxis = chart.Axis(StandardAxis.PrimaryY); NLinearScaleConfigurator linearScale = yAxis.ScaleConfigurator as NLinearScaleConfigurator; NScaleStripStyle strip = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); strip.Interlaced = true; strip.SetShowAtWall(ChartWallType.Back, true); linearScale.StripStyles.Add(strip); // setup a bar series NBarSeries bar = new NBarSeries(); bar.Name = "Bar Series"; bar.InflateMargins = true; bar.UseXValues = false; bar.DataLabelStyle.Visible = false; NPalette palette = new NPalette(); palette.Clear(); palette.Add(0, Color.Green); palette.Add(60, Color.Yellow); palette.Add(120, Color.Red); bar.Palette = palette; chart.Series.Add(bar); int indicatorCount = 10; // add some data to the bar series for (int i = 0; i < indicatorCount; i++) { bar.Values.Add(i * 15); } bar.PaletteColorMode = (PaletteColorMode)PaletteModeDropDownList.SelectedIndex; bar.Palette.SmoothPalette = SmoothPaletteCheckBox.Checked; // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SmoothPaletteCheckBox.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Legends[0].Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Float Bar Palette"); 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.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalHalf); chart.Axis(StandardAxis.Depth).Visible = false; // add interlace stripe NAxis yAxis = chart.Axis(StandardAxis.PrimaryY); NLinearScaleConfigurator linearScale = yAxis.ScaleConfigurator as NLinearScaleConfigurator; NScaleStripStyle strip = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); strip.Interlaced = true; strip.SetShowAtWall(ChartWallType.Back, true); linearScale.StripStyles.Add(strip); // create the float bar series NFloatBarSeries floatBar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar); floatBar.DataLabelStyle.Visible = false; floatBar.DataLabelStyle.VertAlign = VertAlign.Center; floatBar.DataLabelStyle.Format = "<begin> - <end>"; // add bars floatBar.AddDataPoint(new NFloatBarDataPoint(2, 10)); floatBar.AddDataPoint(new NFloatBarDataPoint(5, 16)); floatBar.AddDataPoint(new NFloatBarDataPoint(9, 17)); floatBar.AddDataPoint(new NFloatBarDataPoint(12, 21)); floatBar.AddDataPoint(new NFloatBarDataPoint(8, 18)); floatBar.AddDataPoint(new NFloatBarDataPoint(7, 18)); floatBar.AddDataPoint(new NFloatBarDataPoint(3, 11)); floatBar.AddDataPoint(new NFloatBarDataPoint(5, 12)); floatBar.AddDataPoint(new NFloatBarDataPoint(8, 17)); floatBar.AddDataPoint(new NFloatBarDataPoint(6, 15)); floatBar.AddDataPoint(new NFloatBarDataPoint(3, 10)); floatBar.AddDataPoint(new NFloatBarDataPoint(1, 7)); NPalette palette = new NPalette(); palette.Clear(); palette.Mode = PaletteMode.Custom; palette.Add(0, Color.Green); palette.Add(10, Color.Yellow); palette.Add(20, Color.Red); floatBar.Palette = palette; floatBar.Palette.SmoothPalette = SmoothPaletteCheckBox.Checked; // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Float Bar Palette"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); // no legend nChartControl1.Legends.Clear(); // configure the chart m_Chart = nChartControl1.Charts[0]; m_Chart.Enable3D = true; m_Chart.Axis(StandardAxis.Depth).Visible = false; // setup X axis NOrdinalScaleConfigurator scaleX = m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator; scaleX.AutoLabels = false; scaleX.MajorTickMode = MajorTickMode.AutoMaxCount; scaleX.DisplayDataPointsBetweenTicks = false; for (int i = 0; i < monthLetters.Length; i++) { scaleX.CustomLabels.Add(new NCustomValueLabel(i, monthLetters[i])); } // add interlaced stripe to the Y axis NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Left }; stripStyle.Interlaced = true; linearScale.StripStyles.Add(stripStyle); // create the float bar series m_FloatBar = (NFloatBarSeries)m_Chart.Series.Add(SeriesType.FloatBar); m_FloatBar.DataLabelStyle.Visible = false; m_FloatBar.DataLabelStyle.VertAlign = VertAlign.Center; m_FloatBar.DataLabelStyle.Format = "<begin> - <end>"; // add bars m_FloatBar.AddDataPoint(new NFloatBarDataPoint(2, 10)); m_FloatBar.AddDataPoint(new NFloatBarDataPoint(5, 16)); m_FloatBar.AddDataPoint(new NFloatBarDataPoint(9, 17)); m_FloatBar.AddDataPoint(new NFloatBarDataPoint(12, 21)); m_FloatBar.AddDataPoint(new NFloatBarDataPoint(8, 18)); m_FloatBar.AddDataPoint(new NFloatBarDataPoint(7, 18)); m_FloatBar.AddDataPoint(new NFloatBarDataPoint(3, 11)); m_FloatBar.AddDataPoint(new NFloatBarDataPoint(5, 12)); m_FloatBar.AddDataPoint(new NFloatBarDataPoint(8, 17)); m_FloatBar.AddDataPoint(new NFloatBarDataPoint(6, 15)); m_FloatBar.AddDataPoint(new NFloatBarDataPoint(3, 10)); m_FloatBar.AddDataPoint(new NFloatBarDataPoint(1, 7)); NPalette palette = new NPalette(); palette.SmoothPalette = true; palette.Clear(); palette.Mode = PaletteMode.Custom; palette.Add(0, Color.Green); palette.Add(10, Color.Yellow); palette.Add(20, Color.Red); m_FloatBar.Palette = palette; // apply layout ConfigureStandardLayout(m_Chart, title, null); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); SmoothPaletteCheckBox.IsChecked = true; Enable3DCheckBox.IsChecked = true; }