Пример #1
0
        private void AddPieButton_Click(object sender, EventArgs e)
        {
            NChart     chart     = nChartControl1.Charts[0];
            NPieSeries pieSeries = (NPieSeries)chart.Series[0];

            double     value = Convert.ToDouble(PieValueTextBox.Text);
            String     text  = "Pie " + Convert.ToString(pieSeries.Values.Count + 1);
            NFillStyle fill  = new NColorFillStyle(WebExamplesUtilities.RandomColor());

            pieSeries.AddDataPoint(new NDataPoint(value, text, fill));
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SortOrderDropDownList.Items.Add("Ascending");
                SortOrderDropDownList.Items.Add("Descending");
                SortOrderDropDownList.SelectedIndex = 0;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // add header
            NLabel header = nChartControl1.Labels.AddHeader("Sorting Data");

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

            NChart chart = nChartControl1.Charts[0];

            chart.BoundsMode = BoundsMode.Stretch;
            chart.Axis(StandardAxis.Depth).Visible = false;
            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(80, NRelativeUnit.ParentPercentage));

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

            bar.Values.FillRandom(Random, 6);
            bar.Labels.FillRandom(Random, 6);

            for (int i = 0; i < bar.Values.Count; i++)
            {
                bar.FillStyles[i] = new NColorFillStyle(WebExamplesUtilities.RandomColor());
            }

            bar.Legend.Mode = SeriesLegendMode.DataPoints;
            bar.Values.Sort((DataSeriesSortOrder)SortOrderDropDownList.SelectedIndex);
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

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

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

            nChartControl1.Legends[0].Mode = LegendMode.Disabled;

            NChart chart = nChartControl1.Charts[0];

            // perform manual stretch
            float fAspect = ((float)nChartControl1.Width.Value / (float)nChartControl1.Height.Value);

            // perform manual stretch
            if (fAspect > 1)
            {
                chart.Width  = 86 * fAspect;
                chart.Height = 70;
            }
            else
            {
                chart.Width  = 86;
                chart.Height = 70 * fAspect;
            }

            chart.Location = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage),
                                         new NLength(18, NRelativeUnit.ParentPercentage));
            chart.Size = new NSizeL(new NLength(86, NRelativeUnit.ParentPercentage),
                                    new NLength(70, NRelativeUnit.ParentPercentage));

            chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal);
            chart.Wall(ChartWallType.Floor).Visible = false;
            chart.Wall(ChartWallType.Left).Visible  = false;
            chart.Axis(StandardAxis.Depth).Visible  = false;

            chart.Axis(StandardAxis.Depth).Visible = false;
            NOrdinalScaleConfigurator ordinalScaleConfigurator = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator;

            ordinalScaleConfigurator.InnerMajorTickStyle.LineStyle.Width = new NLength(0, NGraphicsUnit.Pixel);
            ordinalScaleConfigurator.MajorGridStyle.LineStyle.Pattern    = LinePattern.Dot;
            ordinalScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, false);
            ordinalScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            NDockAxisAnchor anchor = new NDockAxisAnchor(AxisDockZone.FrontBottom, false, 5, 95);

            chart.Axis(StandardAxis.PrimaryX).Anchor = anchor;
            NLinearScaleConfigurator linearSclaeConfigurator = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;

            linearSclaeConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;

            NLineSeries line = (NLineSeries)chart.Series.Add(SeriesType.Line);
            NBarSeries  bar  = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar.Name = "Bar Series";
            bar.BorderStyle.Width      = new NLength(0, NGraphicsUnit.Pixel);
            bar.FillStyle              = new NColorFillStyle(Color.MediumPurple);
            bar.DataLabelStyle.Visible = false;
            bar.InflateMargins         = true;

            // fill with random data
            Random random = new Random();

            bar.Values.FillRandom(random, 10);

            // generate a data series cumulative sum of the bar values
            NFunctionCalculator fc = new NFunctionCalculator();

            fc.Expression = "CUMSUM(Value)";
            fc.Arguments.Add(bar.Values);

            // display this data series as line
            line.Name   = "Cumulative";
            line.Values = fc.Calculate();
            line.MarkerStyle.Visible    = true;
            line.MarkerStyle.PointShape = PointShape.Cylinder;
            line.DataLabelStyle.Visible = false;
            line.DataLabelStyle.ArrowStrokeStyle.Width = new NLength(0, NGraphicsUnit.Pixel);

            bar.BarShape = BarShape.Cylinder;

            for (int i = 0; i < bar.Values.Count; i++)
            {
                bar.FillStyles[i] = new NColorFillStyle(WebExamplesUtilities.RandomColor());
            }
            bar.Legend.Mode  = SeriesLegendMode.DataPoints;
            line.Legend.Mode = SeriesLegendMode.None;

            NImageResponse imageResponse = new NImageResponse();

            imageResponse.StreamImageToBrowser = true;
            nChartControl1.ServerSettings.BrowserResponseSettings.DefaultResponse = imageResponse;
            nChartControl1.RenderControl(null);
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            NChart chart = nChartControl1.Charts[0];

            chart.Width      = 100;
            chart.Height     = 60;
            chart.BoundsMode = BoundsMode.Fit;
            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(70, NRelativeUnit.ParentPercentage));


            chart.Axis(StandardAxis.Depth).Visible = false;
            chart.Wall(ChartWallType.Back).Visible = false;

            m_Line1      = (NLineSeries)chart.Series.Add(SeriesType.Line);
            m_Line1.Name = "Line 1";
            m_Line1.DataLabelStyle.Visible = false;
            m_Line1.BorderStyle.Color      = Color.DodgerBlue;
            m_Line1.FillStyle                     = new NColorFillStyle(Color.DodgerBlue);
            m_Line1.MarkerStyle.FillStyle         = new NColorFillStyle(Color.DodgerBlue);
            m_Line1.MarkerStyle.BorderStyle.Color = Color.DodgerBlue;
            m_Line1.MarkerStyle.PointShape        = PointShape.Cylinder;
            m_Line1.MarkerStyle.Visible           = true;
            m_Line1.ShadowStyle.Type              = ShadowType.GaussianBlur;

            m_Line2                               = (NLineSeries)chart.Series.Add(SeriesType.Line);
            m_Line2.Name                          = "Line 2";
            m_Line2.MultiLineMode                 = MultiLineMode.Overlapped;
            m_Line2.DataLabelStyle.Visible        = false;
            m_Line2.BorderStyle.Color             = Color.Orange;
            m_Line2.FillStyle                     = new NColorFillStyle(Color.Orange);
            m_Line2.MarkerStyle.FillStyle         = new NColorFillStyle(Color.Orange);
            m_Line2.MarkerStyle.BorderStyle.Color = Color.Orange;
            m_Line2.MarkerStyle.PointShape        = PointShape.Cylinder;
            m_Line2.MarkerStyle.Visible           = true;
            m_Line2.ShadowStyle.Type              = ShadowType.GaussianBlur;

            m_Bar = (NBarSeries)chart.Series.Add(SeriesType.Bar);
            m_Bar.DataLabelStyle.Visible = false;
            for (int i = 0; i < m_Bar.Values.Count; i++)
            {
                m_Bar.FillStyles[i] = new NColorFillStyle(WebExamplesUtilities.RandomColor());
            }
            m_Bar.Name = "Bar 1";

            GenerateData();

            // add header
            NLabel header = nChartControl1.Labels.AddHeader("Basic SVG Chart");

            header.TextStyle.BackplaneStyle.Visible = false;
            header.TextStyle.ShadowStyle.Type       = ShadowType.GaussianBlur;
            header.TextStyle.FillStyle = new NColorFillStyle(Color.Black);
            header.ContentAlignment    = ContentAlignment.BottomRight;
            header.Location            = new NPointL(new NLength(3, NRelativeUnit.ParentPercentage),
                                                     new NLength(3, NRelativeUnit.ParentPercentage));


            NImageResponse  svgImageResponse = new NImageResponse();
            NSvgImageFormat svgImageFormat   = new NSvgImageFormat();

            svgImageResponse.ImageFormat = svgImageFormat;
            nChartControl1.ServerSettings.BrowserResponseSettings.DefaultResponse = svgImageResponse;
        }
Пример #5
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;
            }
        }
        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;
        }
Пример #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // the control will save its state in the temp directory along with the
            // temporary image files
            nChartControl1.ServerSettings.ControlStateSettings.PersistControlState = true;

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

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

            if (!IsPostBack)
            {
                // set a chart title
                NLabel title = nChartControl1.Labels.AddHeader("Persistent server control");
                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));

                // no legend
                nChartControl1.Legends.Clear();

                // setup a pie chart
                NPieChart chart = new NPieChart();
                nChartControl1.Charts.Clear();
                nChartControl1.Charts.Add(chart);

                chart.Enable3D = true;
                chart.LightModel.EnableLighting = true;
                chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.MetallicLustre);
                chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveElevated);
                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(65, NRelativeUnit.ParentPercentage));

                // add a pie series
                NPieSeries pieSeries = (NPieSeries)chart.Series.Add(SeriesType.Pie);
                pieSeries.PieStyle  = PieStyle.SmoothEdgePie;
                pieSeries.LabelMode = PieLabelMode.SpiderNoOverlap;

                // show a hand when over a pie slice
                pieSeries.InteractivityStyle.Cursor.Type = CursorType.Hand;

                pieSeries.AddDataPoint(new NDataPoint(8, "Pie 1"));
                pieSeries.AddDataPoint(new NDataPoint(4, "Pie 2"));
                pieSeries.AddDataPoint(new NDataPoint(7, "Pie 3"));
                pieSeries.AddDataPoint(new NDataPoint(9, "Pie 4"));

                for (int i = 0; i < pieSeries.Values.Count; i++)
                {
                    pieSeries.FillStyles[i] = new NColorFillStyle(WebExamplesUtilities.RandomColor());
                }
            }

            this.AddPieButton.Click        += new EventHandler(this.AddPieButton_Click);
            this.DeleteLastPieButton.Click += new EventHandler(this.DeleteLastPieButton_Click);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            NChart     chart;
            NBarSeries bar;

            nChartControl1.Legends[0].SetPredefinedLegendStyle(PredefinedLegendStyle.Bottom);

            chart            = nChartControl1.Charts[0];
            chart.BoundsMode = BoundsMode.Fit;
            chart.Location   = new NPointL(new NLength(20, NRelativeUnit.ParentPercentage),
                                           new NLength(20, NRelativeUnit.ParentPercentage));
            chart.Size = new NSizeL(new NLength(60, NRelativeUnit.ParentPercentage),
                                    new NLength(60, NRelativeUnit.ParentPercentage));

            chart.Depth = 20;
            bar         = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar.AddDataPoint(new NDataPoint(100 + Random.Next(100), "Toyota", new NColorFillStyle(Color.Red)));
            bar.AddDataPoint(new NDataPoint(100 + Random.Next(100), "Volkswagen", new NColorFillStyle(Color.Gold)));
            bar.AddDataPoint(new NDataPoint(100 + Random.Next(100), "Ford", new NColorFillStyle(Color.Chocolate)));
            bar.AddDataPoint(new NDataPoint(100 + Random.Next(100), "Mazda", new NColorFillStyle(Color.LimeGreen)));

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

            // add urls to redirect to

            NInteractivityStyle interactivityStyle = new NInteractivityStyle("Click here to jump to Toyota home page", CursorType.Hand);

            interactivityStyle.UrlLink.Url             = "http://www.toyota.com";
            interactivityStyle.UrlLink.OpenInNewWindow = OpenLinkInNewWindowCheckBox.Checked;
            bar.InteractivityStyles.Add(0, interactivityStyle);

            interactivityStyle                         = new NInteractivityStyle("Click here to jump to VW home page", CursorType.Hand);
            interactivityStyle.UrlLink.Url             = "http://www.vw.com";
            interactivityStyle.UrlLink.OpenInNewWindow = OpenLinkInNewWindowCheckBox.Checked;
            bar.InteractivityStyles.Add(1, interactivityStyle);

            interactivityStyle                         = new NInteractivityStyle("Click here to jump to Ford home page", CursorType.Hand);
            interactivityStyle.UrlLink.Url             = "http://www.ford.com";
            interactivityStyle.UrlLink.OpenInNewWindow = OpenLinkInNewWindowCheckBox.Checked;
            bar.InteractivityStyles.Add(2, interactivityStyle);

            interactivityStyle                         = new NInteractivityStyle("Click here to jump to Mazda home page", CursorType.Hand);
            interactivityStyle.UrlLink.Url             = "http://www.mazda.com";
            interactivityStyle.UrlLink.OpenInNewWindow = OpenLinkInNewWindowCheckBox.Checked;
            bar.InteractivityStyles.Add(3, interactivityStyle);

            for (int i = 0; i < bar.Values.Count; i++)
            {
                bar.FillStyles[i] = new NColorFillStyle(WebExamplesUtilities.RandomColor());
            }

            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.NorthernLights);
            chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal);

            // add header
            NLabel header = nChartControl1.Labels.AddHeader("Car Sales per Company<br/><font size = '10'>Demonstrates anchor SVG tags</font>");

            header.TextStyle.BackplaneStyle.Visible = false;
            header.TextStyle.TextFormat             = TextFormat.XML;
            header.TextStyle.FillStyle = new NColorFillStyle(Color.Black);
            header.ContentAlignment    = ContentAlignment.BottomRight;
            header.Location            = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage),
                                                     new NLength(2, NRelativeUnit.ParentPercentage));

            NImageResponse  imageResponse  = new NImageResponse();
            NSvgImageFormat svgImageFormat = new NSvgImageFormat();

            svgImageFormat.EnableInteractivity = true;
            svgImageFormat.CustomScript        = "";

            imageResponse.ImageFormat = svgImageFormat;

            nChartControl1.ServerSettings.BrowserResponseSettings.DefaultResponse = imageResponse;
        }
        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);
        }