public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("2D Funnel Chart"); 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)); NLegend legend = nChartControl1.Legends[0]; legend.SetPredefinedLegendStyle(PredefinedLegendStyle.BottomRight); NFunnelChart chart = new NFunnelChart(); nChartControl1.Charts.Clear(); nChartControl1.Charts.Add(chart); NFunnelSeries funnel = (NFunnelSeries)chart.Series.Add(SeriesType.Funnel); funnel.BorderStyle.Color = Color.LemonChiffon; funnel.Legend.DisplayOnLegend = legend; funnel.Legend.Mode = SeriesLegendMode.DataPoints; funnel.DataLabelStyle.Format = "<percent>"; funnel.ShadowStyle.Type = ShadowType.GaussianBlur; funnel.ShadowStyle.Color = Color.FromArgb(50, 0, 0, 0); funnel.ShadowStyle.Offset = new NPointL(5, 5); funnel.ShadowStyle.FadeLength = new NLength(6); funnel.Values.Add(20.0); funnel.Values.Add(10.0); funnel.Values.Add(15.0); funnel.Values.Add(7.0); funnel.Values.Add(28.0); funnel.Labels.Add("Awareness"); funnel.Labels.Add("First Hear"); funnel.Labels.Add("Further Learn"); funnel.Labels.Add("Liking"); funnel.Labels.Add("Decision"); // apply palette to funnel segments NChartPalette palette = new NChartPalette(ChartPredefinedPalette.Fresh); for (int i = 0; i < funnel.Values.Count; i++) { funnel.FillStyles[i] = new NColorFillStyle(palette.SeriesColors[i % palette.SeriesColors.Count]); } // init form controls LabelModeCombo.FillFromEnum(typeof(FunnelLabelMode)); LabelModeCombo.SelectedIndex = 0; FunnelGapScroll.Value = (int)funnel.FunnelPointGap; NeckWidthScroll.Value = (int)funnel.NeckWidthPercent; NeckHeightScroll.Value = (int)funnel.NeckHeightPercent; ArrowLengthScroll.Value = (int)funnel.DataLabelStyle.ArrowLength.Value; }
private void LabelModeCombo_SelectedIndexChanged(object sender, System.EventArgs e) { NFunnelSeries funnel = (NFunnelSeries)nChartControl1.Charts[0].Series[0]; funnel.LabelMode = (FunnelLabelMode)LabelModeCombo.SelectedIndex; HorzAlign ha = HorzAlign.Center; switch (funnel.LabelMode) { case FunnelLabelMode.Left: case FunnelLabelMode.LeftAligned: ha = HorzAlign.Right; break; case FunnelLabelMode.Right: case FunnelLabelMode.RightAligned: ha = HorzAlign.Left; break; } funnel.DataLabelStyle.TextStyle.StringFormatStyle.HorzAlign = ha; nChartControl1.Refresh(); }
private void FunnelPointGapScrollBar_ValueChanged(object sender, System.Windows.RoutedPropertyChangedEventArgs <double> e) { NFunnelSeries funnel = (NFunnelSeries)nChartControl1.Charts[0].Series[0]; funnel.FunnelPointGap = (float)FunnelPointGapScrollBar.Value * 10.0f; nChartControl1.Refresh(); }
private void LabelArrowLengthScrollBar_ValueChanged(object sender, System.Windows.RoutedPropertyChangedEventArgs <double> e) { NFunnelSeries funnel = (NFunnelSeries)nChartControl1.Charts[0].Series[0]; funnel.DataLabelStyle.ArrowLength = new NLength((float)LabelArrowLengthScrollBar.Value * 100.0f, NRelativeUnit.ParentPercentage); nChartControl1.Refresh(); }
private void NeckHeightScrollBar_ValueChanged(object sender, System.Windows.RoutedPropertyChangedEventArgs <double> e) { NFunnelSeries funnel = (NFunnelSeries)nChartControl1.Charts[0].Series[0]; funnel.NeckHeightPercent = (float)NeckHeightScrollBar.Value * 100.0f; nChartControl1.Refresh(); }
private void ArrowLengthScroll_Scroll(object sender, Nevron.UI.WinForm.Controls.ScrollBarEventArgs e) { NFunnelSeries funnel = (NFunnelSeries)nChartControl1.Charts[0].Series[0]; funnel.DataLabelStyle.ArrowLength = new NLength(ArrowLengthScroll.Value, NRelativeUnit.ParentPercentage); nChartControl1.Refresh(); }
private void FunnelGapScroll_Scroll(object sender, Nevron.UI.WinForm.Controls.ScrollBarEventArgs e) { NFunnelSeries funnel = (NFunnelSeries)nChartControl1.Charts[0].Series[0]; funnel.FunnelPointGap = FunnelGapScroll.Value / 10.0f; nChartControl1.Refresh(); }
private void NeckHeightScroll_Scroll(object sender, Nevron.UI.WinForm.Controls.ScrollBarEventArgs e) { NFunnelSeries funnel = (NFunnelSeries)nChartControl1.Charts[0].Series[0]; funnel.NeckHeightPercent = NeckHeightScroll.Value; nChartControl1.Refresh(); }
private void NewDataButton_Click(object sender, System.EventArgs e) { NFunnelSeries funnel = (NFunnelSeries)nChartControl1.Charts[0].Series[0]; GenerateData(funnel); nChartControl1.Refresh(); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("2D Funnel Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.ShadowStyle.Offset = new NPointL(1.5f, 1.5f); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); NLegend legend = nChartControl1.Legends[0]; legend.SetPredefinedLegendStyle(PredefinedLegendStyle.BottomRight); NFunnelChart chart = new NFunnelChart(); chart.Location = new NPointL(new NLength(20, NRelativeUnit.ParentPercentage), new NLength(10, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL(new NLength(60, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage)); chart.BoundsMode = BoundsMode.Stretch; nChartControl1.Charts.Clear(); nChartControl1.Charts.Add(chart); // configure funnel series NFunnelSeries funnel = (NFunnelSeries)chart.Series.Add(SeriesType.Funnel); funnel.BorderStyle.Color = Color.LemonChiffon; funnel.Legend.DisplayOnLegend = legend; funnel.Legend.Format = "<percent>"; funnel.Legend.Mode = SeriesLegendMode.DataPoints; funnel.DataLabelStyle.Format = "<value> [<xsize>]"; funnel.UseXSizes = true; funnel.Values.ValueFormatter = new NNumericValueFormatter("0.00"); funnel.XSizes.ValueFormatter = new NNumericValueFormatter("0.00"); // configure shadow funnel.ShadowStyle.Type = ShadowType.GaussianBlur; funnel.ShadowStyle.Color = Color.FromArgb(50, 0, 0, 0); funnel.ShadowStyle.Offset = new NPointL(5, 5); funnel.ShadowStyle.FadeLength = new NLength(6); GenerateData(funnel); // init form controls LabelModeCombo.FillFromEnum(typeof(FunnelLabelMode)); LabelModeCombo.SelectedIndex = 4; FunnelGapScroll.Value = 6; ArrowLengthScroll.Value = (int)funnel.DataLabelStyle.ArrowLength.Value; }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("3D Funnel Chart"); 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)); NLegend legend = nChartControl1.Legends[0]; legend.SetPredefinedLegendStyle(PredefinedLegendStyle.BottomRight); NFunnelChart chart = new NFunnelChart(); chart.Enable3D = true; chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.BrightCameraLight); chart.Projection.Elevation = 15; nChartControl1.Charts.Clear(); nChartControl1.Charts.Add(chart); NFunnelSeries funnel = (NFunnelSeries)chart.Series.Add(SeriesType.Funnel); funnel.BorderStyle.Color = Color.LemonChiffon; funnel.Legend.DisplayOnLegend = legend; funnel.Legend.Format = "<percent>"; funnel.Legend.Mode = SeriesLegendMode.DataPoints; funnel.DataLabelStyle.Format = "<value> [<xsize>]"; funnel.UseXSizes = true; funnel.Values.ValueFormatter = new NNumericValueFormatter("0.00"); funnel.XSizes.ValueFormatter = new NNumericValueFormatter("0.00"); GenerateData(funnel); // init form controls LabelModeCombo.FillFromEnum(typeof(FunnelLabelMode)); LabelModeCombo.SelectedIndex = 4; FunnelGapScroll.Value = 6; FunnelRadiusScroll.Value = (int)chart.Width; ArrowLengthScroll.Value = (int)funnel.DataLabelStyle.ArrowLength.Value; }
private void GenerateData(NFunnelSeries funnel) { funnel.ClearDataPoints(); double dSizeX = 100; NChartPalette palette = new NChartPalette(ChartPredefinedPalette.Fresh); for (int i = 0; i < 10; i++) { funnel.Values.Add(Random.NextDouble() + 1); funnel.XSizes.Add(dSizeX); funnel.FillStyles[i] = new NColorFillStyle(palette.SeriesColors[i % palette.SeriesColors.Count]); dSizeX -= Random.NextDouble() * 9; } funnel.Values.Add(0.0); funnel.XSizes.Add(dSizeX); }
/// <summary> /// /// </summary> /// <returns></returns> protected override NWidget CreateExampleContent() { NChartView chartView = CreateFunnelChartView(); // configure title chartView.Surface.Titles[0].Text = "Scatter Funnel"; NFunnelChart funnelChart = (NFunnelChart)chartView.Surface.Charts[0]; m_FunnelSeries = new NFunnelSeries(); m_FunnelSeries.UseXValues = true; m_FunnelSeries.Shape = ENFunnelShape.Rectangle; funnelChart.Series.Add(m_FunnelSeries); GenerateData(); chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, true)); return(chartView); }
private void SetLabelMode(NFunnelSeries funnel) { funnel.LabelMode = (FunnelLabelMode)FunnelLabelModeDropDownList.SelectedIndex; HorzAlign ha = HorzAlign.Center; switch (funnel.LabelMode) { case FunnelLabelMode.Left: case FunnelLabelMode.LeftAligned: ha = HorzAlign.Right; break; case FunnelLabelMode.Right: case FunnelLabelMode.RightAligned: ha = HorzAlign.Left; break; } funnel.DataLabelStyle.TextStyle.StringFormatStyle.HorzAlign = ha; }
/// <summary> /// /// </summary> /// <returns></returns> protected override NWidget CreateExampleContent() { NChartView chartView = CreateFunnelChartView(); // configure title chartView.Surface.Titles[0].Text = "Standard Funnel"; NFunnelChart funnelChart = (NFunnelChart)chartView.Surface.Charts[0]; m_FunnelSeries = new NFunnelSeries(); funnelChart.Series.Add(m_FunnelSeries); m_FunnelSeries.DataPoints.Add(new NFunnelDataPoint(20.0, "Awareness")); m_FunnelSeries.DataPoints.Add(new NFunnelDataPoint(10.0, "First Hear")); m_FunnelSeries.DataPoints.Add(new NFunnelDataPoint(15.0, "Further Learn")); m_FunnelSeries.DataPoints.Add(new NFunnelDataPoint(7.0, "Liking")); m_FunnelSeries.DataPoints.Add(new NFunnelDataPoint(28.0, "Decision")); chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, true)); return(chartView); }
private void GenerateData(NFunnelSeries funnel) { funnel.ClearDataPoints(); double dSizeX = 100; int i = 0; for (i = 0; i < 10; i++) { funnel.Values.Add(Random.NextDouble() + 1); funnel.XSizes.Add(dSizeX); dSizeX -= Random.NextDouble() * 9; } funnel.Values.Add(0.0); funnel.XSizes.Add(dSizeX); for (i = 0; i < arrCustomColors1.Length; i++) { funnel.FillStyles[i] = arrCustomColors1[i]; } }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { // set a chart title NLabel title = nChartControl1.Labels.AddHeader("3D Funnel Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); NLegend legend = nChartControl1.Legends[0]; legend.SetPredefinedLegendStyle(PredefinedLegendStyle.BottomRight); NFunnelChart chart = new NFunnelChart(); chart.Enable3D = true; chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.BrightCameraLight); chart.Projection.Elevation = 15; nChartControl1.Charts.Clear(); nChartControl1.Charts.Add(chart); NFunnelSeries funnel = (NFunnelSeries)chart.Series.Add(SeriesType.Funnel); funnel.BorderStyle.Color = Color.LemonChiffon; funnel.Legend.DisplayOnLegend = legend; funnel.Legend.Format = "<percent>"; funnel.Legend.Mode = SeriesLegendMode.DataPoints; funnel.DataLabelStyle.Format = "<value> [<xsize>]"; funnel.UseXSizes = true; funnel.Values.ValueFormatter = new NNumericValueFormatter("0.00"); funnel.XSizes.ValueFormatter = new NNumericValueFormatter("0.00"); GenerateData(funnel); }
protected void Page_Load(object sender, System.EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Funnel Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; title.ContentAlignment = ContentAlignment.BottomRight; title.Location = new NPointL( new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // setup legend NLegend legend = nChartControl1.Legends[0]; legend.SetPredefinedLegendStyle(PredefinedLegendStyle.BottomRight); // setup chart NFunnelChart chart = new NFunnelChart(); chart.BoundsMode = BoundsMode.Fit; 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)); nChartControl1.Charts.Clear(); nChartControl1.Charts.Add(chart); NFunnelSeries funnel = (NFunnelSeries)chart.Series.Add(SeriesType.Funnel); funnel.BorderStyle.Color = Color.LemonChiffon; funnel.Legend.DisplayOnLegend = legend; funnel.Legend.Mode = SeriesLegendMode.DataPoints; funnel.DataLabelStyle.Format = "<percent>"; funnel.ShadowStyle.Type = ShadowType.GaussianBlur; funnel.ShadowStyle.Color = Color.FromArgb(50, 0, 0, 0); funnel.ShadowStyle.Offset = new NPointL(5, 5); funnel.ShadowStyle.FadeLength = new NLength(6); funnel.Values.Add(20.0); funnel.Values.Add(10.0); funnel.Values.Add(15.0); funnel.Values.Add(7.0); funnel.Values.Add(28.0); funnel.Labels.Add("Awareness"); funnel.Labels.Add("First Hear"); funnel.Labels.Add("Further Learn"); funnel.Labels.Add("Liking"); funnel.Labels.Add("Decision"); funnel.FillStyles[0] = new NColorFillStyle(Color.FromArgb(169, 121, 11)); funnel.FillStyles[1] = new NColorFillStyle(Color.FromArgb(157, 157, 92)); funnel.FillStyles[2] = new NColorFillStyle(Color.FromArgb(98, 152, 92)); funnel.FillStyles[3] = new NColorFillStyle(Color.FromArgb(111, 134, 181)); funnel.FillStyles[4] = new NColorFillStyle(Color.FromArgb(179, 63, 92)); if (!IsPostBack) { // init form controls WebExamplesUtilities.FillComboWithEnumValues(FunnelLabelModeDropDownList, typeof(FunnelLabelMode)); FunnelLabelModeDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithValues(FunnelRadiusDropDownList, 0, 100, 10); FunnelRadiusDropDownList.SelectedIndex = (int)(chart.Width / 10); WebExamplesUtilities.FillComboWithValues(FunnelPointGapDropDownList, 0, 100, 10); FunnelPointGapDropDownList.SelectedIndex = (int)(funnel.FunnelPointGap / 10); WebExamplesUtilities.FillComboWithValues(NeckWidthDropDownList, 0, 100, 10); NeckWidthDropDownList.SelectedIndex = (int)(funnel.NeckWidthPercent / 10); WebExamplesUtilities.FillComboWithValues(NeckHeightDropDownList, 0, 100, 10); NeckHeightDropDownList.SelectedIndex = (int)(funnel.NeckHeightPercent / 10); WebExamplesUtilities.FillComboWithValues(LabelArrowLengthDropDownList, 0, 10, 1); LabelArrowLengthDropDownList.SelectedIndex = (int)(funnel.DataLabelStyle.ArrowLength.Value); } SetLabelMode(funnel); // set funnel arrow length funnel.DataLabelStyle.ArrowLength = new NLength((float)(LabelArrowLengthDropDownList.SelectedIndex), NRelativeUnit.ParentPercentage); // set funnel radius nChartControl1.Charts[0].Width = FunnelRadiusDropDownList.SelectedIndex * 10.0f; // set funnel gap funnel.FunnelPointGap = FunnelPointGapDropDownList.SelectedIndex; // set neck width funnel.NeckWidthPercent = NeckWidthDropDownList.SelectedIndex * 10.0f; // set neck height funnel.NeckHeightPercent = NeckHeightDropDownList.SelectedIndex * 10.0f; }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { // set a chart title NLabel title = nChartControl1.Labels.AddHeader("3D Funnel Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(Color.SteelBlue); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); NLegend legend = nChartControl1.Legends[0]; legend.SetPredefinedLegendStyle(PredefinedLegendStyle.BottomRight); NFunnelChart chart = new NFunnelChart(); chart.Enable3D = true; chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.NorthernLights); chart.Projection.Elevation = 4; nChartControl1.Charts.Clear(); nChartControl1.Charts.Add(chart); NFunnelSeries funnel = (NFunnelSeries)chart.Series.Add(SeriesType.Funnel); funnel.BorderStyle.Color = Color.LemonChiffon; funnel.Legend.DisplayOnLegend = legend; funnel.Legend.Mode = SeriesLegendMode.DataPoints; funnel.DataLabelStyle.Format = "<percent>"; funnel.Values.Add(20.0); funnel.Values.Add(10.0); funnel.Values.Add(15.0); funnel.Values.Add(7.0); funnel.Values.Add(28.0); funnel.Labels.Add("Awareness"); funnel.Labels.Add("First Hear"); funnel.Labels.Add("Further Learn"); funnel.Labels.Add("Liking"); funnel.Labels.Add("Decision"); // apply palette to funnel segments NChartPalette palette = new NChartPalette(ChartPredefinedPalette.Fresh); for (int i = 0; i < funnel.Values.Count; i++) { funnel.FillStyles[i] = new NColorFillStyle(palette.SeriesColors[i % palette.SeriesColors.Count]); } // init form controls NExampleHelpers.FillComboWithEnumValues(FunnelLabelModeComboBox, typeof(FunnelLabelMode)); FunnelLabelModeComboBox.SelectedIndex = 0; FunnelRadiusScrollBar.Value = chart.Width / 100.0f; FunnelPointGapScrollBar.Value = funnel.FunnelPointGap / 10.0f; NeckWidthScrollBar.Value = funnel.NeckWidthPercent / 100.0f; NeckHeightScrollBar.Value = funnel.NeckHeightPercent / 100.0f; LabelArrowLengthScrollBar.Value = funnel.DataLabelStyle.ArrowLength.Value / 100.0f; }
protected void Page_Load(object sender, System.EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Funnel Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; title.ContentAlignment = ContentAlignment.BottomRight; title.Location = new NPointL( new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); NLegend legend = nChartControl1.Legends[0]; legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Bottom); legend.Data.ExpandMode = LegendExpandMode.RowsFixed; legend.Data.RowCount = 2; NFunnelChart chart = new NFunnelChart(); chart.BoundsMode = BoundsMode.Fit; chart.Location = new NPointL( new NLength(10, NRelativeUnit.ParentPercentage), new NLength(12, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL( new NLength(80, NRelativeUnit.ParentPercentage), new NLength(68, NRelativeUnit.ParentPercentage)); nChartControl1.Charts.Clear(); nChartControl1.Charts.Add(chart); NFunnelSeries funnel = (NFunnelSeries)chart.Series.Add(SeriesType.Funnel); funnel.BorderStyle.Color = Color.LemonChiffon; funnel.Legend.DisplayOnLegend = legend; funnel.Legend.Format = "<percent>"; funnel.Legend.Mode = SeriesLegendMode.DataPoints; funnel.DataLabelStyle.Format = "<value> [<xsize>]"; funnel.UseXSizes = true; funnel.Values.ValueFormatter = new NNumericValueFormatter("0.00"); funnel.XSizes.ValueFormatter = new NNumericValueFormatter("0.00"); GenerateData(funnel); if (!IsPostBack) { // init form controls WebExamplesUtilities.FillComboWithEnumValues(FunnelLabelModeDropDownList, typeof(FunnelLabelMode)); FunnelLabelModeDropDownList.SelectedIndex = (int)FunnelLabelMode.RightAligned; WebExamplesUtilities.FillComboWithValues(FunnelPointGapDropDownList, 0, 15, 1); FunnelPointGapDropDownList.SelectedIndex = 6; WebExamplesUtilities.FillComboWithValues(FunnelRadiusDropDownList, 0, 100, 10); FunnelRadiusDropDownList.SelectedIndex = (int)(chart.Width / 10.0f); WebExamplesUtilities.FillComboWithValues(FunnelArrowLengthDropDownList, 0, 10, 1); FunnelArrowLengthDropDownList.SelectedIndex = 1; } // init funnel label mode funnel.LabelMode = (FunnelLabelMode)FunnelLabelModeDropDownList.SelectedIndex; HorzAlign ha = HorzAlign.Center; switch (funnel.LabelMode) { case FunnelLabelMode.Left: case FunnelLabelMode.LeftAligned: ha = HorzAlign.Right; break; case FunnelLabelMode.Right: case FunnelLabelMode.RightAligned: ha = HorzAlign.Left; break; } funnel.DataLabelStyle.TextStyle.StringFormatStyle.HorzAlign = ha; // arrow length funnel.DataLabelStyle.ArrowLength = new NLength((float)FunnelArrowLengthDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage); // funnel radius chart.Width = FunnelRadiusDropDownList.SelectedIndex * 10; funnel.FunnelPointGap = FunnelPointGapDropDownList.SelectedIndex / 10.0f; }
protected void Page_Load(object sender, System.EventArgs e) { nChartControl1.Settings.JitterMode = JitterMode.Enabled; nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("3D Funnel Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; title.ContentAlignment = ContentAlignment.BottomRight; title.Location = new NPointL( new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); NLegend legend = nChartControl1.Legends[0]; legend.SetPredefinedLegendStyle(PredefinedLegendStyle.BottomRight); NFunnelChart chart = new NFunnelChart(); chart.BoundsMode = BoundsMode.Fit; chart.Location = new NPointL(new NLength(5, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL(new NLength(85, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage)); chart.Enable3D = true; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.NorthernLights); chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective); chart.Projection.Elevation = 18; nChartControl1.Charts.Clear(); nChartControl1.Charts.Add(chart); NFunnelSeries funnel = (NFunnelSeries)chart.Series.Add(SeriesType.Funnel); funnel.BorderStyle.Color = Color.LemonChiffon; funnel.Legend.DisplayOnLegend = legend; funnel.Legend.Mode = SeriesLegendMode.DataPoints; funnel.DataLabelStyle.Format = "<percent>"; funnel.Values.Add(20.0); funnel.Values.Add(10.0); funnel.Values.Add(15.0); funnel.Values.Add(7.0); funnel.Values.Add(28.0); funnel.Labels.Add("Awareness"); funnel.Labels.Add("First Hear"); funnel.Labels.Add("Further Learn"); funnel.Labels.Add("Liking"); funnel.Labels.Add("Decision"); NChartPalette palette = new NChartPalette(ChartPredefinedPalette.Bright); for (int i = 0; i < funnel.Values.Count; i++) { funnel.FillStyles[i] = palette.SeriesColors[i % palette.SeriesColors.Count]; } if (!IsPostBack) { // init form controls WebExamplesUtilities.FillComboWithEnumValues(FunnelLabelModeDropDownList, typeof(FunnelLabelMode)); FunnelLabelModeDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithValues(FunnelRadiusDropDownList, 0, 100, 10); FunnelRadiusDropDownList.SelectedIndex = (int)(chart.Width / 10); WebExamplesUtilities.FillComboWithValues(FunnelPointGapDropDownList, 0, 100, 10); FunnelPointGapDropDownList.SelectedIndex = (int)(funnel.FunnelPointGap / 10); WebExamplesUtilities.FillComboWithValues(NeckWidthDropDownList, 0, 100, 10); NeckWidthDropDownList.SelectedIndex = (int)(funnel.NeckWidthPercent / 10); WebExamplesUtilities.FillComboWithValues(NeckHeightDropDownList, 0, 100, 10); NeckHeightDropDownList.SelectedIndex = (int)(funnel.NeckHeightPercent / 10); WebExamplesUtilities.FillComboWithValues(LabelArrowLengthDropDownList, 0, 10, 1); LabelArrowLengthDropDownList.SelectedIndex = (int)(funnel.DataLabelStyle.ArrowLength.Value); } SetLabelMode(funnel); // set funnel arrow length funnel.DataLabelStyle.ArrowLength = new NLength((float)(LabelArrowLengthDropDownList.SelectedIndex), NRelativeUnit.ParentPercentage); // set funnel radius nChartControl1.Charts[0].Width = FunnelRadiusDropDownList.SelectedIndex * 10.0f; // set funnel gap funnel.FunnelPointGap = FunnelPointGapDropDownList.SelectedIndex; // set neck width funnel.NeckWidthPercent = NeckWidthDropDownList.SelectedIndex * 10.0f; // set neck height funnel.NeckHeightPercent = NeckHeightDropDownList.SelectedIndex * 10.0f; }