Ejemplo n.º 1
0
        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;
        }
        public override void Initialize()
        {
            base.Initialize();

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Printed Chart Appearance");

            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);

            m_Chart = new NPieChart();
            nChartControl1.Charts.Clear();
            nChartControl1.Charts.Add(m_Chart);
            m_Chart.Depth           = 18;
            m_Chart.DisplayOnLegend = nChartControl1.Legends[0];

            m_Pie = (NPieSeries)m_Chart.Series.Add(SeriesType.Pie);
            m_Pie.BorderStyle.Color = Color.LemonChiffon;

            m_Pie.AddDataPoint(new NDataPoint(24, "Cars", new NColorFillStyle(Color.FromArgb(169, 121, 11))));
            m_Pie.AddDataPoint(new NDataPoint(18, "Airplanes", new NColorFillStyle(Color.FromArgb(157, 157, 92))));
            m_Pie.AddDataPoint(new NDataPoint(32, "Trains", new NColorFillStyle(Color.FromArgb(98, 152, 92))));
            m_Pie.AddDataPoint(new NDataPoint(23, "Ships", new NColorFillStyle(Color.FromArgb(111, 134, 181))));
            m_Pie.AddDataPoint(new NDataPoint(19, "Buses", new NColorFillStyle(Color.FromArgb(179, 63, 92))));

            m_Pie.Legend.Mode   = SeriesLegendMode.DataPoints;
            m_Pie.Legend.Format = "<label> <percent>";
        }
        protected void PredefinedStyleDropDownList_SelectedIndexChanged(object sender, EventArgs e)
        {
            m_Legend.SetPredefinedLegendStyle((PredefinedLegendStyle)PredefinedStyleDropDownList.SelectedIndex);

            ExpandModeDropDownList.SelectedIndex = (int)m_Legend.Data.ExpandMode;

            RowCountDropDownList.Enabled = false;
            ColCountDropDownList.Enabled = false;
        }
Ejemplo n.º 4
0
        public void SetLenged()
        {
            var legend = new NLegend();

            //   legend.DockMode = PanelDockMode.Right;
            legend.SetPredefinedLegendStyle(PredefinedLegendStyle.TopRight);
            legend.Padding = new NMarginsL(0, 16, 0, 0);
            nChartControl1.Panels.Add(legend);
            this._Chart.DisplayOnLegend = legend;
        }
Ejemplo n.º 5
0
        private void PredefinedPositionsComboBox_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (nChartControl1 == null)
            {
                return;
            }

            m_Legend.SetPredefinedLegendStyle((PredefinedLegendStyle)PredefinedPositionsComboBox.SelectedIndex);
            UpdateControlsFromLegend();
            nChartControl1.Refresh();
        }
Ejemplo n.º 6
0
        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;
        }
Ejemplo n.º 7
0
        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;
        }
        /// <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);
        }
Ejemplo n.º 9
0
        public override void Initialize()
        {
            base.Initialize();

            nChartControl1.Controller.Tools.Clear();
            nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
            nChartControl1.Controller.Tools.Add(new NTrackballTool());

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("3D Pie Chart Shapes");

            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));

            // setup the legend
            NLegend legend = nChartControl1.Legends[0];

            legend.SetPredefinedLegendStyle(PredefinedLegendStyle.BottomRight);

            NPieChart pieChart = new NPieChart();

            pieChart.Enable3D = true;

            nChartControl1.Charts.Clear();
            nChartControl1.Charts.Add(pieChart);

            NPointLightSource ls = new NPointLightSource();

            ls.CoordinateMode = LightSourceCoordinateMode.Camera;
            ls.Position       = new NVector3DF(0, 0, 50);
            ls.Ambient        = Color.FromArgb(30, 30, 30);
            ls.Diffuse        = Color.FromArgb(180, 180, 180);
            ls.Specular       = Color.FromArgb(100, 100, 100);

            pieChart.LightModel.LightSources.Clear();
            pieChart.LightModel.LightSources.Add(ls);

            pieChart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveElevated);
            pieChart.Depth           = 10;
            pieChart.DisplayOnLegend = nChartControl1.Legends[0];
            pieChart.Location        = new NPointL(new NLength(20, NRelativeUnit.ParentPercentage), new NLength(20, NRelativeUnit.ParentPercentage));
            pieChart.Size            = new NSizeL(new NLength(60, NRelativeUnit.ParentPercentage), new NLength(60, NRelativeUnit.ParentPercentage));
            pieChart.InnerRadius     = new NLength(20, NRelativeUnit.ParentPercentage);

            NPieSeries pieSeries = (NPieSeries)pieChart.Series.Add(SeriesType.Pie);

            pieSeries.BorderStyle.Color = Color.LemonChiffon;

            pieSeries.DataLabelStyle.ArrowLength        = new NLength(10, NGraphicsUnit.Point);
            pieSeries.DataLabelStyle.ArrowPointerLength = new NLength(0, NGraphicsUnit.Point);

            pieSeries.Legend.Mode   = SeriesLegendMode.DataPoints;
            pieSeries.Legend.Format = "<label> <percent>";

            pieSeries.AddDataPoint(new NDataPoint(24, "Cars", new NColorFillStyle(Color.FromArgb(169, 121, 11))));
            pieSeries.AddDataPoint(new NDataPoint(18, "Airplanes", new NColorFillStyle(Color.FromArgb(157, 157, 92))));
            pieSeries.AddDataPoint(new NDataPoint(32, "Trains", new NColorFillStyle(Color.FromArgb(98, 152, 92))));
            pieSeries.AddDataPoint(new NDataPoint(23, "Ships", new NColorFillStyle(Color.FromArgb(111, 134, 181))));
            pieSeries.AddDataPoint(new NDataPoint(19, "Buses", new NColorFillStyle(Color.FromArgb(179, 63, 92))));

            // apply style sheet
            NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor);

            styleSheet.Apply(nChartControl1.Document);

            // init form controls
            PieShapeCombo.FillFromEnum(typeof(PieStyle));
            PieShapeCombo.SelectedIndex = (int)PieStyle.Ring;

            PieLabelModeCombo.FillFromEnum(typeof(PieLabelMode));
            PieLabelModeCombo.SelectedIndex = 0;

            EdgePercentScroll.Value = (int)pieSeries.PieEdgePercent;
            OuterRadiusScroll.Value = (int)pieChart.Radius.Value;
            InnerRadiusScroll.Value = (int)pieChart.InnerRadius.Value;

            ArrowLengthScroll.Value        = (int)pieSeries.DataLabelStyle.ArrowLength.Value;
            ArrowPointerLengthScroll.Value = (int)pieSeries.DataLabelStyle.ArrowPointerLength.Value;
            ConnectorLengthScroll.Value    = (int)pieSeries.ConnectorLength.Value;
            LeadOffLengthScroll.Value      = (int)pieSeries.LeadOffArrowLength.Value;

            BeginAngleScroll.Value = (int)pieChart.BeginAngle;
            TotalAngleScroll.Value = (int)pieChart.TotalAngle;
        }
Ejemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            NLegend legend = nChartControl1.Legends[0];

            legend.ShadowStyle.Type = ShadowType.GaussianBlur;
            legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Left);
            legend.Location         = new NPointL(legend.Location.X, new NLength(50, NRelativeUnit.ParentPercentage));
            legend.ContentAlignment = ContentAlignment.BottomRight;

            // set a chart title
            NLabel header = nChartControl1.Labels.AddHeader("Transport Sales Analysis");

            header.Location                   = new NPointL(new NLength(97, NRelativeUnit.ParentPercentage), new NLength(3, NRelativeUnit.ParentPercentage));
            header.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            header.ContentAlignment           = ContentAlignment.BottomLeft;

            // by default the chart contains a cartesian chart which cannot display pie series
            nChartControl1.Charts.Clear();

            NPieChart chart = new NPieChart();

            chart.Enable3D = true;
            nChartControl1.Charts.Add(chart);
            chart.DisplayOnLegend = nChartControl1.Legends[0];

            NPieSeries pie = (NPieSeries)chart.Series.Add(SeriesType.Pie);

            pie.AddDataPoint(new NDataPoint(12, "Cars", new NColorFillStyle(Color.Red)));
            pie.AddDataPoint(new NDataPoint(42, "Trains", new NColorFillStyle(Color.Gold)));
            pie.AddDataPoint(new NDataPoint(56, "Ships", new NColorFillStyle(Color.Chocolate)));
            pie.AddDataPoint(new NDataPoint(23, "Buses", new NColorFillStyle(Color.Cyan)));


            pie.InteractivityStyles.Add(0, new NInteractivityStyle("Cars", CursorType.Hand));
            pie.InteractivityStyles.Add(1, new NInteractivityStyle("Trains", CursorType.Hand));
            pie.InteractivityStyles.Add(2, new NInteractivityStyle("Ships", CursorType.Hand));
            pie.InteractivityStyles.Add(3, new NInteractivityStyle("Buses", CursorType.Hand));

            pie.Legend.Mode   = SeriesLegendMode.DataPoints;
            pie.Legend.Format = "<label> <percent>";

            pie.PieStyle  = PieStyle.SmoothEdgePie;
            pie.LabelMode = PieLabelMode.Spider;

            pie.LabelMode = PieLabelMode.Center;
            pie.DataLabelStyle.ArrowLength        = new NLength(0f, NRelativeUnit.ParentPercentage);
            pie.DataLabelStyle.ArrowPointerLength = new NLength(0f, NRelativeUnit.ParentPercentage);

            chart.LightModel.EnableLighting = true;
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.NorthernLights);
            chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveElevated);
            chart.BoundsMode = BoundsMode.Fit;
            chart.Location   = new NPointL(
                new NLength(35, NRelativeUnit.ParentPercentage),
                new NLength(30, NRelativeUnit.ParentPercentage));
            chart.Size = new NSizeL(
                new NLength(60, NRelativeUnit.ParentPercentage),
                new NLength(60, NRelativeUnit.ParentPercentage));


            NHtmlImageMapResponse imageMapResponse = new NHtmlImageMapResponse();

            nChartControl1.ServerSettings.BrowserResponseSettings.DefaultResponse = imageMapResponse;

            nChartControl1.Settings.JitterMode     = JitterMode.Enabled;
            nChartControl1.Settings.JitteringSteps = 4;

            // select the car sales by default
            if (!IsPostBack)
            {
                for (int i = 0; i < pie.Values.Count; i++)
                {
                    pie.Detachments.Add(0);
                }

                SalesOverTimeImg.ImageUrl = "NInteractiveCarSalesPage.aspx";
            }

            ApplyImageMapAttributesToSerie(pie);

            this.nChartControl1.Click += new EventHandler(this.NChartControl1_Click);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            NChartControl nChartControl1 = new NChartControl();

            nChartControl1.Width  = 420;
            nChartControl1.Height = 320;
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("HTML Image Map and Binary Streaming");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            title.ContentAlignment           = ContentAlignment.BottomCenter;
            title.Location = new NPointL(
                new NLength(50, NRelativeUnit.ParentPercentage),
                new NLength(2, NRelativeUnit.ParentPercentage));

            // setup the legend
            NLegend legend = nChartControl1.Legends[0];

            legend.Mode = LegendMode.Disabled;
            legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Bottom);

            // setup a pie chart
            NPieChart chart = new NPieChart();

            nChartControl1.Charts.Clear();
            nChartControl1.Charts.Add(chart);
            chart.DisplayOnLegend = legend;
            chart.Location        = new NPointL(
                new NLength(10, NRelativeUnit.ParentPercentage),
                new NLength(17, NRelativeUnit.ParentPercentage));
            chart.Size = new NSizeL(
                new NLength(80, NRelativeUnit.ParentPercentage),
                new NLength(66, NRelativeUnit.ParentPercentage));
            chart.InnerRadius = new NLength(20, NRelativeUnit.ParentPercentage);

            // add a pie series
            NPieSeries pieSeries = (NPieSeries)chart.Series.Add(SeriesType.Pie);

            pieSeries.PieStyle              = PieStyle.Torus;
            pieSeries.LabelMode             = PieLabelMode.Rim;
            pieSeries.DataLabelStyle.Format = "<label> <percent>";
            pieSeries.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8, NGraphicsUnit.Point);
            pieSeries.Legend.Mode   = SeriesLegendMode.DataPoints;
            pieSeries.Legend.Format = "<label> <value>";
            pieSeries.Legend.TextStyle.FontStyle.EmSize = new NLength(8, NGraphicsUnit.Point);

            pieSeries.AddDataPoint(new NDataPoint(12, "Metals"));
            pieSeries.AddDataPoint(new NDataPoint(42, "Glass"));
            pieSeries.AddDataPoint(new NDataPoint(23, "Plastics"));
            pieSeries.AddDataPoint(new NDataPoint(56, "Paper"));
            pieSeries.AddDataPoint(new NDataPoint(23, "Other"));

            // add urls to redirect to
            pieSeries.InteractivityStyles.Add(0, new NInteractivityStyle("Metals"));
            pieSeries.InteractivityStyles.Add(1, new NInteractivityStyle("Glass"));
            pieSeries.InteractivityStyles.Add(2, new NInteractivityStyle("Plastics"));
            pieSeries.InteractivityStyles.Add(3, new NInteractivityStyle("Paper"));
            pieSeries.InteractivityStyles.Add(4, new NInteractivityStyle("Other"));

            pieSeries.PieStyle  = PieStyle.Torus;
            pieSeries.LabelMode = PieLabelMode.Spider;

            NHtmlImageMapResponse imageMapResponse = new NHtmlImageMapResponse();

            imageMapResponse.CreateImageFile = false;
            imageMapResponse.ImageFileName   = "NChartImageMap";
            imageMapResponse.ImageMapName    = "MAP_NChartImageMap";
            nChartControl1.ServerSettings.BrowserResponseSettings.DefaultResponse = imageMapResponse;

            this.Controls.Add(nChartControl1);
        }
        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;
        }
Ejemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // init form controls
                WebExamplesUtilities.FillComboWithEnumValues(PieStyleDropDownList, typeof(PieStyle));
                PieStyleDropDownList.SelectedIndex = (int)PieStyle.Ring;

                PieLabelModeDropDownList.Items.Add("Center");
                PieLabelModeDropDownList.Items.Add("Rim");
                PieLabelModeDropDownList.Items.Add("Spider");
                PieLabelModeDropDownList.SelectedIndex = 1;

                WebExamplesUtilities.FillComboWithValues(ArrowLengthDropDownList, 0, 10, 1);
                ArrowLengthDropDownList.SelectedIndex = 4;

                WebExamplesUtilities.FillComboWithValues(ArrowPointerLengthDropDownList, 0, 10, 1);
                ArrowPointerLengthDropDownList.SelectedIndex = 4;

                WebExamplesUtilities.FillComboWithValues(DepthDropDownList, 0, 100, 10);
                DepthDropDownList.SelectedIndex = 1;

                WebExamplesUtilities.FillComboWithValues(BeginAngleDropDownList, 0, 360, 10);
                BeginAngleDropDownList.SelectedIndex = 0;

                WebExamplesUtilities.FillComboWithValues(TotalAngleDropDownList, 0, 360, 10);
                TotalAngleDropDownList.SelectedIndex = 36;

                LightsCheckBox.Checked = true;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
            nChartControl1.Settings.JitterMode = JitterMode.Enabled;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Pie 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.FillStyle = new NColorFillStyle(Color.FromArgb(124, 255, 255, 255));
            legend.HorizontalBorderStyle.Width = new NLength(0);
            legend.VerticalBorderStyle.Width   = new NLength(0);
            legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Bottom);
            legend.Data.ExpandMode  = LegendExpandMode.RowsFixed;
            legend.Data.RowCount    = 2;
            legend.Data.CellMargins = new NMarginsL(
                new NLength(6, NGraphicsUnit.Pixel),
                new NLength(3, NGraphicsUnit.Pixel),
                new NLength(6, NGraphicsUnit.Pixel),
                new NLength(3, NGraphicsUnit.Pixel));
            legend.Data.MarkSize = new NSizeL(
                new NLength(7, NGraphicsUnit.Pixel),
                new NLength(7, NGraphicsUnit.Pixel));


            // by default the control contains a Cartesian chart -> remove it and create a Pie chart
            NPieChart pieChart = new NPieChart();

            nChartControl1.Charts.Clear();
            nChartControl1.Charts.Add(pieChart);

            pieChart.Enable3D        = true;
            pieChart.DisplayOnLegend = nChartControl1.Legends[0];
            pieChart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveElevated);
            pieChart.Depth      = DepthDropDownList.SelectedIndex * 10;
            pieChart.BoundsMode = BoundsMode.Fit;
            pieChart.Location   = new NPointL(
                new NLength(12, NRelativeUnit.ParentPercentage),
                new NLength(12, NRelativeUnit.ParentPercentage));
            pieChart.Size = new NSizeL(
                new NLength(76, NRelativeUnit.ParentPercentage),
                new NLength(68, NRelativeUnit.ParentPercentage));

            pieChart.BeginAngle  = BeginAngleDropDownList.SelectedIndex * 10;
            pieChart.TotalAngle  = TotalAngleDropDownList.SelectedIndex * 10;
            pieChart.InnerRadius = new NLength(40);

            // setup pie series
            NPieSeries pie = (NPieSeries)pieChart.Series.Add(SeriesType.Pie);

            pie.Legend.Mode   = SeriesLegendMode.DataPoints;
            pie.Legend.Format = "<label> <percent>";
            pie.Legend.TextStyle.FontStyle.EmSize = new NLength(8, NGraphicsUnit.Point);
            pie.PieStyle  = (PieStyle)PieStyleDropDownList.SelectedIndex;
            pie.LabelMode = (PieLabelMode)PieLabelModeDropDownList.SelectedIndex;
            pie.DataLabelStyle.ArrowLength        = new NLength((float)ArrowLengthDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage);
            pie.DataLabelStyle.ArrowPointerLength = new NLength((float)ArrowPointerLengthDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage);


            pie.AddDataPoint(new NDataPoint(12, "Bikes"));
            pie.AddDataPoint(new NDataPoint(22, "Trains"));
            pie.AddDataPoint(new NDataPoint(19, "Cars"));
            pie.AddDataPoint(new NDataPoint(51, "Planes"));
            pie.AddDataPoint(new NDataPoint(23, "Buses", new NColorFillStyle(Color.Red)));

            // apply style sheet
            NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor);

            styleSheet.Apply(nChartControl1.Document);

            switch (pie.LabelMode)
            {
            case PieLabelMode.Center:
                ArrowPointerLengthDropDownList.Enabled = false;
                ArrowLengthDropDownList.Enabled        = false;
                break;

            case PieLabelMode.Rim:
                ArrowPointerLengthDropDownList.Enabled = true;
                ArrowLengthDropDownList.Enabled        = true;
                break;

            case PieLabelMode.Spider:
                ArrowPointerLengthDropDownList.Enabled = true;
                ArrowLengthDropDownList.Enabled        = true;
                break;
            }

            if (LightsCheckBox.Checked)
            {
                pieChart.LightModel.EnableLighting = true;
                pieChart.LightModel.SetPredefinedLightModel(PredefinedLightModel.BrightCameraLight);
            }
            else
            {
                pieChart.LightModel.EnableLighting = false;
            }
        }
Ejemplo n.º 14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            NLegend legend = nChartControl1.Legends[0];

            legend.FillStyle.SetTransparencyPercent(50);
            legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Bottom);
            legend.Data.ExpandMode = LegendExpandMode.RowsFixed;
            legend.Data.RowCount   = 2;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Import from Data Reader");

            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));

            // configure the chart
            NChart chart = nChartControl1.Charts[0];

            chart.Width      = 100.0f;
            chart.Height     = 65.0f;
            chart.BoundsMode = BoundsMode.Stretch;
            chart.Location   = new NPointL(
                new NLength(10, NRelativeUnit.ParentPercentage),
                new NLength(20, NRelativeUnit.ParentPercentage));
            chart.Size = new NSizeL(
                new NLength(80, NRelativeUnit.ParentPercentage),
                new NLength(58, NRelativeUnit.ParentPercentage));

            // create a bar chart
            NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar.DataLabelStyle.Visible = false;
            bar.Legend.Mode            = SeriesLegendMode.DataPoints;

            OleDbConnection myConnection = null;
            OleDbDataReader myReader     = null;

            try
            {
                // create a database connection object using the connection string
                myConnection = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" + this.MapPathSecure(this.TemplateSourceDirectory + "\\DataBinding.mdb"));

                // create a database command on the connection using query
                OleDbCommand myCommand = new OleDbCommand("select * from Sales", myConnection);

                // import the SalesAmount and ProductName into the bar Values and Labels
                myCommand.Connection.Open();
                myReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection);

                NDataSeriesCollection arrSeries = bar.GetDataSeries(DataSeriesMask.Values | DataSeriesMask.Labels, DataSeriesMask.None, false);
                string[] arrCollumns            = { "SalesAmount", "ProductName" };

                arrSeries.FillFromDataReader(myReader, arrCollumns);
            }
            finally
            {
                if (myReader != null)
                {
                    myReader.Close();
                }

                if (myConnection != null)
                {
                    myConnection.Close();
                }
            }

            // apply style sheet
            NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor);

            styleSheet.Apply(nChartControl1.Document);
        }
        private void ConfigureControl(NChartControl control, string sLabel)
        {
            control.BackgroundStyle.FrameStyle.Visible = false;

            // generate image map respones
            NHtmlImageMapResponse imageMapResponse = new NHtmlImageMapResponse();

            control.ServerSettings.BrowserResponseSettings.BrowserResponsePairs.Clear();
            control.ServerSettings.BrowserResponseSettings.DefaultResponse = imageMapResponse;

            // set a chart title
            NLabel title = control.Labels.AddHeader(sLabel);

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            title.ContentAlignment           = ContentAlignment.BottomCenter;
            title.Location = new NPointL(
                new NLength(50, NRelativeUnit.ParentPercentage),
                new NLength(2, NRelativeUnit.ParentPercentage));

            NLegend legend = control.Legends[0];

            legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Bottom);
            legend.Data.ExpandMode  = LegendExpandMode.ColsFixed;
            legend.Data.ColCount    = 2;
            legend.ShadowStyle.Type = ShadowType.GaussianBlur;

            NPieChart chart = new NPieChart();

            control.Charts.Clear();
            control.Charts.Add(chart);
            chart.DisplayOnLegend = legend;
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.NorthernLights);
            chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveElevated);
            chart.BoundsMode = BoundsMode.Fit;
            chart.Location   = new NPointL(
                new NLength(15, NRelativeUnit.ParentPercentage),
                new NLength(25, NRelativeUnit.ParentPercentage));
            chart.Size = new NSizeL(
                new NLength(70, NRelativeUnit.ParentPercentage),
                new NLength(50, NRelativeUnit.ParentPercentage));

            NPieSeries pie = (NPieSeries)chart.Series.Add(SeriesType.Pie);

            pie.PieStyle  = PieStyle.SmoothEdgePie;
            pie.LabelMode = PieLabelMode.Rim;
            pie.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8, NGraphicsUnit.Point);
            pie.Legend.Mode   = SeriesLegendMode.DataPoints;
            pie.Legend.Format = "<label> <percent>";
            pie.DataLabelStyle.ArrowLength        = new NLength(0f, NRelativeUnit.ParentPercentage);
            pie.DataLabelStyle.ArrowPointerLength = new NLength(0f, NRelativeUnit.ParentPercentage);

            pie.AddDataPoint(new NDataPoint(12, "Cars"));
            pie.AddDataPoint(new NDataPoint(42, "Trains"));
            pie.AddDataPoint(new NDataPoint(56, "Airplanes"));
            pie.AddDataPoint(new NDataPoint(23, "Buses"));

            pie.InteractivityStyles.Add(0, new NInteractivityStyle("Cars", CursorType.Hand));
            pie.InteractivityStyles.Add(1, new NInteractivityStyle("Trains", CursorType.Hand));
            pie.InteractivityStyles.Add(2, new NInteractivityStyle("Airplanes", CursorType.Hand));
            pie.InteractivityStyles.Add(3, new NInteractivityStyle("Buses", CursorType.Hand));

            NPostbackAttribute postbackAttribute = new NPostbackAttribute();

            for (int i = 0; i < pie.InteractivityStyles.Count; i++)
            {
                ((NInteractivityStyle)pie.InteractivityStyles[i]).InteractivityAttributes.Add(postbackAttribute);
                pie.Detachments.Add(0);
            }

            // apply style sheet
            NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor);

            styleSheet.Apply(control.Document);
        }
Ejemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                CaptureMouseEventDropDownList.Items.Add("OnClick");
                CaptureMouseEventDropDownList.Items.Add("OnDblClick");
                CaptureMouseEventDropDownList.Items.Add("OnMouseEnter");
                CaptureMouseEventDropDownList.Items.Add("OnMouseLeave");
                CaptureMouseEventDropDownList.Items.Add("Postback");
                CaptureMouseEventDropDownList.SelectedIndex = 0;
            }

            NBarSeries bar;

            if (!NThinChartControl1.Initialized)
            {
                NThinChartControl1.BackgroundStyle.FrameStyle.Visible = false;

                // set a chart title
                NLabel header = NThinChartControl1.Labels.AddHeader("Client Side Events Tool");
                header.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
                header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
                header.ContentAlignment           = ContentAlignment.BottomRight;
                header.Location = new NPointL(
                    new NLength(2, NRelativeUnit.ParentPercentage),
                    new NLength(2, NRelativeUnit.ParentPercentage));

                // configure the legend
                NLegend legend = NThinChartControl1.Legends[0];
                legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Right);
                legend.FillStyle.SetTransparencyPercent(50);
                legend.Location = new NPointL(new NLength(98, NRelativeUnit.ParentPercentage), legend.Location.Y);

                // configure the chart
                NChart chart = NThinChartControl1.Charts[0];
                chart.Axis(StandardAxis.Depth).Visible = false;
                chart.BoundsMode = BoundsMode.Fit;
                chart.Location   = new NPointL(new NLength(5, NRelativeUnit.ParentPercentage),
                                               new NLength(15, NRelativeUnit.ParentPercentage));
                chart.Size = new NSizeL(new NLength(70, NRelativeUnit.ParentPercentage),
                                        new NLength(70, NRelativeUnit.ParentPercentage));
                chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft);

                // create a bar series
                bar      = (NBarSeries)chart.Series.Add(SeriesType.Bar);
                bar.Name = "My Bar Series";
                bar.DataLabelStyle.Format = "<value>";

                bar.AddDataPoint(new NDataPoint(10, "Ford", new NColorFillStyle(WebExamplesUtilities.RandomColor())));
                bar.AddDataPoint(new NDataPoint(20, "Toyota", new NColorFillStyle(WebExamplesUtilities.RandomColor())));
                bar.AddDataPoint(new NDataPoint(30, "VW", new NColorFillStyle(WebExamplesUtilities.RandomColor())));
                bar.AddDataPoint(new NDataPoint(25, "Mitsubishi", new NColorFillStyle(WebExamplesUtilities.RandomColor())));
                bar.AddDataPoint(new NDataPoint(29, "Jaguar", new NColorFillStyle(WebExamplesUtilities.RandomColor())));

                bar.Legend.Mode            = SeriesLegendMode.DataPoints;
                bar.BarShape               = BarShape.SmoothEdgeBar;
                bar.DataLabelStyle.Visible = false;

                NThinChartControl1.Controller.Tools.Add(new NClientMouseEventTool());
            }
            else
            {
                bar = (NBarSeries)(NThinChartControl1.Charts[0].Series[0]);
            }

            bar.InteractivityStyles.Clear();
            for (int i = 0; i < bar.Values.Count; i++)
            {
                NInteractivityStyle interactivityStyle = new NInteractivityStyle();

                string script = "alert(\"Mouse Event [" + CaptureMouseEventDropDownList.SelectedValue.ToString() + "]. Captured for bar [" + i.ToString() + "])\");";

                switch (CaptureMouseEventDropDownList.SelectedIndex)
                {
                case 0:     // OnClick
                    interactivityStyle.ClientMouseEventAttribute.Click = script;
                    break;

                case 1:     // OnDblClick
                    interactivityStyle.ClientMouseEventAttribute.DoubleClick = script;
                    break;

                case 2:     // OnMouseEnter
                    interactivityStyle.ClientMouseEventAttribute.MouseEnter = script;
                    break;

                case 3:     // OnMouseLeave
                    interactivityStyle.ClientMouseEventAttribute.MouseLeave = script;
                    break;

                case 4:
                    interactivityStyle.ClientMouseEventAttribute.Click = "_doPostback()";
                    break;
                }

                bar.InteractivityStyles[i] = interactivityStyle;
            }
        }
        public override void Initialize(NThinChartControl control)
        {
            NBarSeries bar;

            control.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel header = control.Labels.AddHeader("Capturing Mouse Events");

            header.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            header.ContentAlignment           = ContentAlignment.BottomRight;
            header.Location = new NPointL(
                new NLength(2, NRelativeUnit.ParentPercentage),
                new NLength(2, NRelativeUnit.ParentPercentage));

            // configure the legend
            NLegend legend = control.Legends[0];

            legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Right);
            legend.FillStyle.SetTransparencyPercent(50);
            legend.Location = new NPointL(new NLength(98, NRelativeUnit.ParentPercentage), legend.Location.Y);

            // configure the chart
            NChart chart = control.Charts[0];

            chart.Axis(StandardAxis.Depth).Visible = false;
            chart.BoundsMode = BoundsMode.Fit;
            chart.Location   = new NPointL(new NLength(5, NRelativeUnit.ParentPercentage),
                                           new NLength(15, NRelativeUnit.ParentPercentage));
            chart.Size = new NSizeL(new NLength(70, NRelativeUnit.ParentPercentage),
                                    new NLength(70, NRelativeUnit.ParentPercentage));
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft);

            // create a bar series
            bar      = (NBarSeries)chart.Series.Add(SeriesType.Bar);
            bar.Name = "My Bar Series";
            bar.DataLabelStyle.Format = "<value>";

            bar.AddDataPoint(new NDataPoint(10, "Ford", new NColorFillStyle(RandomColor())));
            bar.AddDataPoint(new NDataPoint(20, "Toyota", new NColorFillStyle(RandomColor())));
            bar.AddDataPoint(new NDataPoint(30, "VW", new NColorFillStyle(RandomColor())));
            bar.AddDataPoint(new NDataPoint(25, "Mitsubishi", new NColorFillStyle(RandomColor())));
            bar.AddDataPoint(new NDataPoint(29, "Jaguar", new NColorFillStyle(RandomColor())));

            bar.Legend.Mode            = SeriesLegendMode.DataPoints;
            bar.BarShape               = BarShape.SmoothEdgeBar;
            bar.DataLabelStyle.Visible = false;

            control.Controller.Tools.Add(new NClientMouseEventTool());

            bar.InteractivityStyles.Clear();

            for (int i = 0; i < bar.Values.Count; i++)
            {
                NInteractivityStyle interactivityStyle = new NInteractivityStyle();

                string script = "alert(\"Mouse Event [Mouse Click]. Captured for bar [" + i.ToString() + "])\");";
                interactivityStyle.ClientMouseEventAttribute.Click = script;
                bar.InteractivityStyles[i] = interactivityStyle;
            }
        }
        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;
        }
Ejemplo n.º 19
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("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, EventArgs e)
        {
            if (!IsPostBack)
            {
                CaptureMouseEventDropDownList.Items.Add("OnClick");
                CaptureMouseEventDropDownList.Items.Add("OnDblClick");
                CaptureMouseEventDropDownList.Items.Add("OnMouseOut");
                CaptureMouseEventDropDownList.Items.Add("OnMouseOver");
                CaptureMouseEventDropDownList.Items.Add("OnMouseWheel");
                CaptureMouseEventDropDownList.SelectedIndex = 0;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel header = nChartControl1.Labels.AddHeader("Capturing Mouse Events");

            header.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            header.ContentAlignment           = ContentAlignment.BottomRight;
            header.Location = new NPointL(
                new NLength(2, NRelativeUnit.ParentPercentage),
                new NLength(2, NRelativeUnit.ParentPercentage));

            // configure the legend
            NLegend legend = nChartControl1.Legends[0];

            legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Right);
            legend.FillStyle.SetTransparencyPercent(50);
            legend.Location = new NPointL(new NLength(98, NRelativeUnit.ParentPercentage), legend.Location.Y);

            // configure the chart
            NChart chart = nChartControl1.Charts[0];

            chart.Axis(StandardAxis.Depth).Visible = false;
            chart.BoundsMode = BoundsMode.Fit;
            chart.Location   = new NPointL(new NLength(5, NRelativeUnit.ParentPercentage),
                                           new NLength(15, NRelativeUnit.ParentPercentage));
            chart.Size = new NSizeL(new NLength(70, NRelativeUnit.ParentPercentage),
                                    new NLength(70, NRelativeUnit.ParentPercentage));
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft);

            // create a bar series
            NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar.Name = "My Bar Series";
            bar.DataLabelStyle.Format = "<value>";

            bar.AddDataPoint(new NDataPoint(10, "Ford", new NColorFillStyle(WebExamplesUtilities.RandomColor())));
            bar.AddDataPoint(new NDataPoint(20, "Toyota", new NColorFillStyle(WebExamplesUtilities.RandomColor())));
            bar.AddDataPoint(new NDataPoint(30, "VW", new NColorFillStyle(WebExamplesUtilities.RandomColor())));
            bar.AddDataPoint(new NDataPoint(25, "Mitsubishi", new NColorFillStyle(WebExamplesUtilities.RandomColor())));
            bar.AddDataPoint(new NDataPoint(29, "Jaguar", new NColorFillStyle(WebExamplesUtilities.RandomColor())));

            bar.Legend.Mode            = SeriesLegendMode.DataPoints;
            bar.BarShape               = BarShape.SmoothEdgeBar;
            bar.DataLabelStyle.Visible = false;

            for (int i = 0; i < bar.Values.Count; i++)
            {
                string customAttribute = CaptureMouseEventDropDownList.SelectedItem.Text + " = \"javascript:alert(' Mouse event [" + CaptureMouseEventDropDownList.SelectedItem.Text + "] intercepted for bar [" + i.ToString() + "] ')\" ";
                NInteractivityStyle interactivityStyle = new NInteractivityStyle();

                interactivityStyle.CustomMapAreaAttribute.JScriptAttribute = customAttribute;

                bar.InteractivityStyles[i] = interactivityStyle;
            }

            // change the response type to image map
            NHtmlImageMapResponse imageMapResponse = new NHtmlImageMapResponse();

            nChartControl1.ServerSettings.BrowserResponseSettings.DefaultResponse = imageMapResponse;
        }
Ejemplo n.º 21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LegendModeDropDownList.Items.Add("Disabled");
                LegendModeDropDownList.Items.Add("Automatic");
                LegendModeDropDownList.Items.Add("Manual");
                LegendModeDropDownList.SelectedIndex = 1;

                PredefinedStyleDropDownList.Items.Add("Top");
                PredefinedStyleDropDownList.Items.Add("Bottom");
                PredefinedStyleDropDownList.Items.Add("Left");
                PredefinedStyleDropDownList.Items.Add("Right");
                PredefinedStyleDropDownList.Items.Add("Top right");
                PredefinedStyleDropDownList.Items.Add("Top left");
                PredefinedStyleDropDownList.SelectedIndex = 4;

                ExpandModeDropDownList.Items.Add("Rows only");
                ExpandModeDropDownList.Items.Add("Cols only");
                ExpandModeDropDownList.Items.Add("Rows fixed");
                ExpandModeDropDownList.Items.Add("Cols fixed");
                ExpandModeDropDownList.SelectedIndex = 0;

                WebExamplesUtilities.FillComboWithValues(ManualItemsDropDownList, 1, 20, 1);
                ManualItemsDropDownList.SelectedIndex = 5;

                WebExamplesUtilities.FillComboWithValues(RowCountDropDownList, 1, 10, 1);
                RowCountDropDownList.SelectedIndex = 5;

                WebExamplesUtilities.FillComboWithValues(ColCountDropDownList, 1, 10, 1);
                ColCountDropDownList.SelectedIndex = 5;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
            nChartControl1.Settings.JitterMode     = JitterMode.Enabled;
            nChartControl1.Settings.JitteringSteps = 4;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Legend General");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;

            // setup the chart
            NChart     chart     = nChartControl1.Charts[0];
            NBarSeries barSeries = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            barSeries.DataLabelStyle.Visible = false;
            barSeries.Legend.Mode            = SeriesLegendMode.DataPoints;
            barSeries.Legend.Format          = "<label> <percent>";
            barSeries.Values.FillRandom(Random, numberOfDataPoints);

            for (int i = 0; i < numberOfDataPoints; i++)
            {
                barSeries.Labels.Add("Item " + i.ToString());
            }

            // setup the legend
            m_Legend = nChartControl1.Legends[0];
            m_Legend.FillStyle.SetTransparencyPercent(50);
            m_Legend.Mode = ((LegendMode)LegendModeDropDownList.SelectedIndex);

            if (m_Legend.Mode != LegendMode.Manual)
            {
                ManualItemsDropDownList.Enabled = false;
            }
            else
            {
                NLegendItemCellData legendItemCellData;
                ManualItemsDropDownList.Enabled = true;

                // fill some manual legend data items.
                int manualItemCount = ManualItemsDropDownList.SelectedIndex + 1;
                for (int i = 0; i < manualItemCount; i++)
                {
                    legendItemCellData = new NLegendItemCellData();

                    legendItemCellData.Text      = "Manual item " + i.ToString();
                    legendItemCellData.MarkShape = LegendMarkShape.Rectangle;

                    Color itemColor = WebExamplesUtilities.RandomColor();

                    legendItemCellData.MarkFillStyle = new NColorFillStyle(itemColor);

                    m_Legend.Data.Items.Add(legendItemCellData);
                }
            }

            m_Legend.Header.Text = LegendHeaderTextBox.Text;
            m_Legend.Footer.Text = LegendFooterTextBox.Text;

            m_Legend.SetPredefinedLegendStyle((PredefinedLegendStyle)PredefinedStyleDropDownList.SelectedIndex);
            m_Legend.Data.ExpandMode = (LegendExpandMode)ExpandModeDropDownList.SelectedIndex;

            if (m_Legend.Data.ExpandMode == LegendExpandMode.ColsOnly || m_Legend.Data.ExpandMode == LegendExpandMode.RowsOnly)
            {
                RowCountDropDownList.Enabled = false;
                ColCountDropDownList.Enabled = false;
            }
            else if (m_Legend.Data.ExpandMode == LegendExpandMode.RowsFixed)
            {
                RowCountDropDownList.Enabled = true;
                ColCountDropDownList.Enabled = false;

                m_Legend.Data.RowCount = RowCountDropDownList.SelectedIndex + 1;
            }
            else if (m_Legend.Data.ExpandMode == LegendExpandMode.ColsFixed)
            {
                RowCountDropDownList.Enabled = false;
                ColCountDropDownList.Enabled = true;

                m_Legend.Data.ColCount = ColCountDropDownList.SelectedIndex + 1;
            }

            // apply style sheet
            NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor);

            styleSheet.Apply(nChartControl1.Document);
        }
Ejemplo n.º 22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                CountryDropDownList.Items.Add("USA");
                CountryDropDownList.Items.Add("CHINA");
                CountryDropDownList.Items.Add("JAPAN");
                CountryDropDownList.Items.Add("GERMANY");
                CountryDropDownList.Items.Add("FRANCE");
                CountryDropDownList.Items.Add("UK");

                CountryDropDownList.SelectedIndex = 0;

                WebExamplesUtilities.FillComboWithPercents(XPositionDropDownList, 10);
                XPositionDropDownList.SelectedIndex = 0;
                WebExamplesUtilities.FillComboWithPercents(YPositionDropDownList, 10);
                YPositionDropDownList.SelectedIndex = 0;

                WebExamplesUtilities.FillComboWithPercents(FlagTransparencyDropDownList, 10);
                FlagTransparencyDropDownList.SelectedIndex = 5;

                ContentAlignmentDropDownList.Items.Add("BottomCenter");
                ContentAlignmentDropDownList.Items.Add("BottomLeft");
                ContentAlignmentDropDownList.Items.Add("BottomRight");
                ContentAlignmentDropDownList.Items.Add("MiddleCenter");
                ContentAlignmentDropDownList.Items.Add("MiddleLeft");
                ContentAlignmentDropDownList.Items.Add("MiddleRight");
                ContentAlignmentDropDownList.Items.Add("TopCenter");
                ContentAlignmentDropDownList.Items.Add("TopLeft");
                ContentAlignmentDropDownList.Items.Add("TopRight");
                ContentAlignmentDropDownList.SelectedIndex = 2;
            }

            // enable the antialiasing of the whole scene
            nChartControl1.Settings.JitterMode = JitterMode.Enabled;
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // by default the chart contains a cartesian chart which cannot display a pie series
            nChartControl1.Charts.Clear();

            // create the legend
            NLegend legend = new NLegend();

            legend.HorizontalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel);
            legend.VerticalBorderStyle.Width   = new NLength(0, NGraphicsUnit.Pixel);
            legend.FillStyle.SetTransparencyPercent(50);
            legend.OuterBottomBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel);
            legend.OuterLeftBorderStyle.Width   = new NLength(0, NGraphicsUnit.Pixel);
            legend.OuterRightBorderStyle.Width  = new NLength(0, NGraphicsUnit.Pixel);
            legend.OuterTopBorderStyle.Width    = new NLength(0, NGraphicsUnit.Pixel);
            legend.SetPredefinedLegendStyle(PredefinedLegendStyle.TopRight);

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Car sales for " + CountryDropDownList.SelectedItem.Text);

            title.ContentAlignment           = ContentAlignment.TopRight;
            title.Location                   = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(98, NRelativeUnit.ParentPercentage));
            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;

            // create the watermark
            NWatermark watermark = new NWatermark();

            watermark.FillStyle        = new NImageFillStyle(this.MapPathSecure(this.TemplateSourceDirectory + "\\" + CountryDropDownList.SelectedItem.Text + ".GIF"));
            watermark.Location         = new NPointL(new NLength(XPositionDropDownList.SelectedIndex * 10, NRelativeUnit.ParentPercentage), new NLength(YPositionDropDownList.SelectedIndex * 10, NRelativeUnit.ParentPercentage));
            watermark.UseAutomaticSize = false;
            watermark.Size             = new NSizeL(150, 100);
            watermark.ContentAlignment = (ContentAlignment)ContentAlignment.Parse(typeof(ContentAlignment), ContentAlignmentDropDownList.SelectedItem.Text);
            watermark.FillStyle.SetTransparencyPercent(FlagTransparencyDropDownList.SelectedIndex * 10.0f);
            watermark.StandardFrameStyle.Visible = false;

            // create the chart
            NPieChart chart = new NPieChart();

            chart.Enable3D = true;
            chart.Depth    = 5;

            if (ShowFlagAboveChartBox.Checked)
            {
                nChartControl1.Panels.Add(chart);
                nChartControl1.Panels.Add(legend);
                nChartControl1.Panels.Add(watermark);
            }
            else
            {
                nChartControl1.Panels.Add(watermark);
                nChartControl1.Panels.Add(chart);
                nChartControl1.Panels.Add(legend);
            }

            chart.DisplayOnLegend = legend;
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.MetallicLustre);
            chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveElevated);

            NPieSeries pie = (NPieSeries)chart.Series.Add(SeriesType.Pie);

            pie.PieStyle               = PieStyle.SmoothEdgePie;
            pie.LabelMode              = PieLabelMode.Center;
            pie.Legend.Mode            = SeriesLegendMode.DataPoints;
            pie.DataLabelStyle.Visible = false;

            pie.AddDataPoint(new NDataPoint(0, "Toyota"));
            pie.AddDataPoint(new NDataPoint(0, "Honda"));
            pie.AddDataPoint(new NDataPoint(0, "Volkswagen"));
            pie.AddDataPoint(new NDataPoint(0, "Chrysler"));
            pie.AddDataPoint(new NDataPoint(0, "Ford"));
            pie.Values.FillRandom(Random, 5);

            // apply style sheet
            NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor);

            styleSheet.Apply(pie);
        }
Ejemplo n.º 23
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (nChartControl1.RequiresInitialization)
            {
                nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
                nChartControl1.Settings.JitterMode = JitterMode.Enabled;

                // configure legend
                NLegend legend = nChartControl1.Legends[0];
                legend.ShadowStyle.Type = ShadowType.GaussianBlur;
                legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Left);
                legend.DockMode        = PanelDockMode.Bottom;
                legend.Margins         = new NMarginsL(0, 0, 0, 10);
                legend.Data.ExpandMode = LegendExpandMode.ColsFixed;
                legend.Data.ColCount   = 2;

                // set a chart title
                NLabel header = nChartControl1.Labels.AddHeader("Product Analysis");
                header.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
                header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
                header.ContentAlignment           = ContentAlignment.BottomRight;
                header.Location = new NPointL(
                    new NLength(3, NRelativeUnit.ParentPercentage),
                    new NLength(3, NRelativeUnit.ParentPercentage));

                // by default the chart contains a cartesian chart which cannot display pie series
                NPieChart chart = new NPieChart();
                chart.Enable3D = true;

                nChartControl1.Charts.Clear();
                nChartControl1.Charts.Add(chart);
                chart.DisplayOnLegend = nChartControl1.Legends[0];

                NPieSeries pie = (NPieSeries)chart.Series.Add(SeriesType.Pie);

                pie.AddDataPoint(new NDataPoint(23, ".NET Vision"));
                pie.AddDataPoint(new NDataPoint(56, "Chart"));
                pie.AddDataPoint(new NDataPoint(42, "Diagram"));
                pie.AddDataPoint(new NDataPoint(12, "User Interface"));

                pie.Legend.Mode   = SeriesLegendMode.DataPoints;
                pie.Legend.Format = "<label> <percent>";

                pie.PieStyle  = PieStyle.SmoothEdgePie;
                pie.LabelMode = PieLabelMode.Spider;

                pie.LabelMode = PieLabelMode.Center;
                pie.DataLabelStyle.ArrowLength        = new NLength(0f, NRelativeUnit.ParentPercentage);
                pie.DataLabelStyle.ArrowPointerLength = new NLength(0f, NRelativeUnit.ParentPercentage);

                chart.LightModel.EnableLighting = true;
                chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.MetallicLustre);
                chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveElevated);
                chart.BoundsMode = BoundsMode.Fit;
                chart.Location   = new NPointL(
                    new NLength(10, NRelativeUnit.ParentPercentage),
                    new NLength(10, NRelativeUnit.ParentPercentage));
                chart.Size = new NSizeL(
                    new NLength(80, NRelativeUnit.ParentPercentage),
                    new NLength(70, NRelativeUnit.ParentPercentage));

                //	set up client side tooltips
                pie.InteractivityStyles.Add(0, new NInteractivityStyle(true, null, ".NET Vision"));
                pie.InteractivityStyles.Add(1, new NInteractivityStyle(true, null, "Chart"));
                pie.InteractivityStyles.Add(2, new NInteractivityStyle(true, null, "Diagram"));
                pie.InteractivityStyles.Add(3, new NInteractivityStyle(true, null, "User Interface"));

                // apply style sheet
                NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor);
                styleSheet.Apply(nChartControl1.Document);
            }
        }
        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;
        }
Ejemplo n.º 25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
            nChartControl1.Settings.JitterMode = JitterMode.Enabled;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("HTML Image Map with Postback (Server Events) 2");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            title.ContentAlignment           = ContentAlignment.BottomCenter;
            title.Location = new NPointL(
                new NLength(50, NRelativeUnit.ParentPercentage),
                new NLength(2, NRelativeUnit.ParentPercentage));

            // configure the legend
            NLegend legend = nChartControl1.Legends[0];

            legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Bottom);
            legend.InteractivityStyle.GeneratePostback = true;
            legend.Header.Text = "Company Score";

            // configure the chart
            NChart chart = nChartControl1.Charts[0];

            chart.Height   = 40;
            chart.Enable3D = true;
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
            chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalHalf);
            chart.BoundsMode = BoundsMode.Fit;
            chart.Location   = new NPointL(
                new NLength(8, NRelativeUnit.ParentPercentage),
                new NLength(15, NRelativeUnit.ParentPercentage));
            chart.Size = new NSizeL(
                new NLength(84, NRelativeUnit.ParentPercentage),
                new NLength(60, NRelativeUnit.ParentPercentage));

            chart.Axis(StandardAxis.Depth).Visible = false;

            chart.Axis(StandardAxis.Depth).InteractivityStyle.GeneratePostback    = true;
            chart.Axis(StandardAxis.PrimaryX).InteractivityStyle.GeneratePostback = true;
            chart.Axis(StandardAxis.PrimaryY).InteractivityStyle.GeneratePostback = true;

            chart.Wall(ChartWallType.Back).InteractivityStyle.GeneratePostback  = true;
            chart.Wall(ChartWallType.Left).InteractivityStyle.GeneratePostback  = true;
            chart.Wall(ChartWallType.Floor).InteractivityStyle.GeneratePostback = true;

            // add an axis stripe
            NAxisStripe stripe = chart.Axis(StandardAxis.PrimaryY).Stripes.Add(20, 33);

            stripe.FillStyle   = new NColorFillStyle(Color.PaleGoldenrod);
            stripe.ShowAtWalls = new ChartWallType[] { ChartWallType.Left, ChartWallType.Back };
            stripe.InteractivityStyle.GeneratePostback = true;

            // setup X axis
            NOrdinalScaleConfigurator ordinalScale = new NOrdinalScaleConfigurator();

            ordinalScale.AutoLabels = false;
            ordinalScale.Labels.Add("Ford");
            ordinalScale.Labels.Add("VW");
            ordinalScale.Labels.Add("Toyota");
            ordinalScale.Labels.Add("BMW");
            ordinalScale.Labels.Add("Peugeot");
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = ordinalScale;

            // add a bar chart
            NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar.Name                       = "Fictive Car sales";
            bar.BarShape                   = BarShape.SmoothEdgeBar;
            bar.Legend.Mode                = SeriesLegendMode.DataPoints;
            bar.DataLabelStyle.Visible     = true;
            bar.DataLabelStyle.Format      = "<value>";
            bar.InteractivityStyle.Tooltip = new NTooltipAttribute("<value> <label>");
            bar.AddDataPoint(new NDataPoint(22, "Ford", new NColorFillStyle(Color.DarkKhaki)));
            bar.AddDataPoint(new NDataPoint(32, "VW", new NColorFillStyle(Color.OliveDrab)));
            bar.AddDataPoint(new NDataPoint(45, "Toyota", new NColorFillStyle(Color.DarkSeaGreen)));
            bar.AddDataPoint(new NDataPoint(27, "BMW", new NColorFillStyle(Color.CadetBlue)));
            bar.AddDataPoint(new NDataPoint(40, "Peugeot", new NColorFillStyle(Color.LightSlateGray)));

            for (int i = 0; i < bar.Values.Count; i++)
            {
                NInteractivityStyle interactivityStyle = new NInteractivityStyle();
                interactivityStyle.GeneratePostback = true;
                bar.InteractivityStyles[i]          = interactivityStyle;
            }

            // configure the control to generate image map with postback
            NHtmlImageMapResponse imageMapResponse = new NHtmlImageMapResponse();

            imageMapResponse.GridCellSize = 2;
            nChartControl1.ServerSettings.BrowserResponseSettings.DefaultResponse = imageMapResponse;

            this.nChartControl1.Click += new EventHandler(this.NChartControl1_Click);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
            nChartControl1.Settings.JitterMode = JitterMode.Enabled;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Pie Slice Radius");

            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.FillStyle = new NColorFillStyle(Color.FromArgb(124, 255, 255, 255));
            legend.HorizontalBorderStyle.Width = new NLength(0);
            legend.VerticalBorderStyle.Width   = new NLength(0);
            legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Bottom);
            legend.Data.ExpandMode  = LegendExpandMode.RowsFixed;
            legend.Data.RowCount    = 2;
            legend.Data.CellMargins = new NMarginsL(
                new NLength(6, NGraphicsUnit.Pixel),
                new NLength(3, NGraphicsUnit.Pixel),
                new NLength(6, NGraphicsUnit.Pixel),
                new NLength(3, NGraphicsUnit.Pixel));
            legend.Data.MarkSize = new NSizeL(
                new NLength(7, NGraphicsUnit.Pixel),
                new NLength(7, NGraphicsUnit.Pixel));

            // by default the control contains a Cartesian chart -> remove it and create a Pie chart
            NPieChart pieChart = new NPieChart();

            nChartControl1.Charts.Clear();
            nChartControl1.Charts.Add(pieChart);

            pieChart.Enable3D        = true;
            pieChart.InnerRadius     = new NLength(0);
            pieChart.DisplayOnLegend = nChartControl1.Legends[0];
            pieChart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveElevated);
            pieChart.BoundsMode = BoundsMode.Fit;
            pieChart.Location   = new NPointL(
                new NLength(12, NRelativeUnit.ParentPercentage),
                new NLength(12, NRelativeUnit.ParentPercentage));
            pieChart.Size = new NSizeL(
                new NLength(76, NRelativeUnit.ParentPercentage),
                new NLength(68, NRelativeUnit.ParentPercentage));

            NPieSeries pieSeries = new NPieSeries();

            pieChart.Series.Add(pieSeries);
            pieSeries.PieEdgePercent           = 30;
            pieSeries.PieStyle                 = PieStyle.SmoothEdgePie;
            pieSeries.Legend.Mode              = SeriesLegendMode.DataPoints;
            pieSeries.Legend.Format            = "<label> <percent>";
            pieSeries.UseBeginEndWidthPercents = true;

            for (int i = 0; i < 9; i++)
            {
                pieSeries.Values.Add(10 + i * 10);
                pieSeries.BeginWidthPercents.Add(0);
                pieSeries.EndWidthPercents.Add(10 + i * 10);
            }

            // apply style sheet
            NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor);

            styleSheet.Apply(nChartControl1.Document);
        }