public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Bevel and Emboss Filter"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // no legend nChartControl1.Legends.Clear(); // configure chart NChart chart = nChartControl1.Charts[0]; chart.Axis(StandardAxis.Depth).Visible = false; chart.Wall(ChartWallType.Back).Visible = false; // add bar and change bar color NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.Name = "Bar Series"; bar.FillStyle = new NGradientFillStyle(GradientStyle.Vertical, GradientVariant.Variant2, Color.DarkRed, Color.Red); bar.BorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); bar.DataLabelStyle.Visible = false; bar.Values.Add(18); bar.Values.Add(15); bar.Values.Add(21); bar.Values.Add(23); bar.Values.Add(28); bar.Values.Add(29); NBevelAndEmbossImageFilter bevelAndEmbossImageFilter = new NBevelAndEmbossImageFilter(); bevelAndEmbossImageFilter.BlurType = BlurType.Gaussian; bar.FillStyle.ImageFiltersStyle.Filters.Add(bevelAndEmbossImageFilter); // init form controls m_bUpdating = true; BevelTypeComboBox.FillFromEnum(typeof(BevelType)); BlurTypeComboBox.FillFromEnum(typeof(BlurType)); BarStyleComboBox.FillFromEnum(typeof(BarShape)); BarStyleComboBox.SelectedIndex = 0; BevelTypeComboBox.SelectedIndex = (int)bevelAndEmbossImageFilter.BevelType; AngleNumericUpDown.Value = (decimal)bevelAndEmbossImageFilter.Angle; DepthNumericUpDown.Value = (decimal)bevelAndEmbossImageFilter.Depth.Value; SoftenNumericUpDown.Value = (decimal)bevelAndEmbossImageFilter.Soften.Value; BlurTypeComboBox.SelectedIndex = (int)bevelAndEmbossImageFilter.BlurType; OriginalOpacityNumericUpDown.Value = (decimal)bevelAndEmbossImageFilter.OriginalOpacity; m_bUpdating = false; }
private void ShadowColorButton_Click(object sender, System.EventArgs e) { NBarSeries bar = (NBarSeries)nChartControl1.Charts[0].Series[0]; NBevelAndEmbossImageFilter bevelAndEmbossImageFilter = ((NBevelAndEmbossImageFilter)bar.FillStyle.ImageFiltersStyle.Filters[0]); colorDialog.Color = bevelAndEmbossImageFilter.ShadowColor; if (colorDialog.ShowDialog() == DialogResult.OK) { bevelAndEmbossImageFilter.ShadowColor = colorDialog.Color; nChartControl1.Refresh(); } }
private void UpdateFilter() { if (m_bUpdating) { return; } m_bUpdating = true; NBarSeries bar = (NBarSeries)nChartControl1.Charts[0].Series[0]; NBevelAndEmbossImageFilter bevelAndEmbossImageFilter = ((NBevelAndEmbossImageFilter)bar.FillStyle.ImageFiltersStyle.Filters[0]); bevelAndEmbossImageFilter.BevelType = (BevelType)BevelTypeComboBox.SelectedIndex; bevelAndEmbossImageFilter.Angle = (float)AngleNumericUpDown.Value; bevelAndEmbossImageFilter.Depth = new NLength((int)DepthNumericUpDown.Value); bevelAndEmbossImageFilter.Soften = new NLength((int)SoftenNumericUpDown.Value); bevelAndEmbossImageFilter.BlurType = (BlurType)BlurTypeComboBox.SelectedIndex; bevelAndEmbossImageFilter.OriginalOpacity = (int)OriginalOpacityNumericUpDown.Value; m_bUpdating = false; nChartControl1.Refresh(); }
private void ChartTypeCombo_SelectedIndexChanged(object sender, EventArgs e) { NChart chart = nChartControl1.Charts[0]; chart.Series.Clear(); SeriesType seriesType = SeriesType.Bar; switch (ChartTypeCombo.SelectedIndex) { case 0: // Bar seriesType = SeriesType.Bar; break; case 1: // Line seriesType = SeriesType.Line; break; case 2: // Area seriesType = SeriesType.Area; break; } // add the first bar m_Series1 = (NSeries)chart.Series.Add(seriesType); m_Series1.Name = "Company A"; m_Series1.DataLabelStyle.Visible = false; // add the second bar m_Series2 = (NSeries)chart.Series.Add(seriesType); m_Series2.Name = "Company B"; m_Series2.DataLabelStyle.Visible = false; // add the third bar m_Series3 = (NSeries)chart.Series.Add(seriesType); m_Series3.Name = "Company C"; m_Series3.DataLabelStyle.Visible = false; // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // apply image filters NBevelAndEmbossImageFilter filter1 = new NBevelAndEmbossImageFilter(); filter1.Depth = new NLength(2); m_Series1.FillStyle.ImageFiltersStyle.Filters.Add(filter1); NBevelAndEmbossImageFilter filter2 = new NBevelAndEmbossImageFilter(); filter2.Depth = new NLength(2); m_Series2.FillStyle.ImageFiltersStyle.Filters.Add(filter2); NBevelAndEmbossImageFilter filter3 = new NBevelAndEmbossImageFilter(); filter3.Depth = new NLength(2); m_Series3.FillStyle.ImageFiltersStyle.Filters.Add(filter3); GenerateNewDataButton_Click(null, null); AggregationComboBox_SelectedIndexChanged(null, null); }