Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Stacked Percent Bar";

            // configure chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear);

            // add interlace stripe
            NLinearScale linearScale = (NLinearScale)chart.Axes[ENCartesianAxis.PrimaryY].Scale;

            linearScale.Labels.TextProvider = new NFormattedScaleLabelTextProvider(new NNumericValueFormatter("P"));
            NScaleStrip stripStyle = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            linearScale.Strips.Add(stripStyle);

            // add the first bar
            m_Bar1              = new NBarSeries();
            m_Bar1.Name         = "Bar1";
            m_Bar1.MultiBarMode = ENMultiBarMode.Series;
            chart.Series.Add(m_Bar1);

            // add the second bar
            m_Bar2              = new NBarSeries();
            m_Bar2.Name         = "Bar2";
            m_Bar2.MultiBarMode = ENMultiBarMode.StackedPercent;
            chart.Series.Add(m_Bar2);

            // add the third bar
            m_Bar3              = new NBarSeries();
            m_Bar3.Name         = "Bar3";
            m_Bar3.MultiBarMode = ENMultiBarMode.StackedPercent;
            chart.Series.Add(m_Bar3);

            // setup value formatting
            m_Bar1.ValueFormatter = new NNumericValueFormatter("0.###");
            m_Bar2.ValueFormatter = new NNumericValueFormatter("0.###");
            m_Bar3.ValueFormatter = new NNumericValueFormatter("0.###");

            // position data labels in the center of the bars
            m_Bar1.DataLabelStyle = CreateDataLabelStyle();
            m_Bar2.DataLabelStyle = CreateDataLabelStyle();
            m_Bar3.DataLabelStyle = CreateDataLabelStyle();

            chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, false));

            // pass some data
            OnPositiveDataButtonClick(null);

            return(chartView);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Legend Appearance";

            m_Legend            = chartView.Surface.Legends[0];
            m_Legend.ExpandMode = ENLegendExpandMode.ColsFixed;
            m_Legend.ColCount   = 3;

            m_Legend.Border            = NBorder.CreateFilledBorder(NColor.Black);
            m_Legend.BorderThickness   = new NMargins(2);
            m_Legend.BackgroundFill    = new NStockGradientFill(NColor.White, NColor.LightGray);
            m_Legend.VerticalPlacement = Layout.ENVerticalPlacement.Top;

            // configure chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear);

            // add interlace stripe
            NLinearScale linearScale = chart.Axes[ENCartesianAxis.PrimaryY].Scale as NLinearScale;
            NScaleStrip  strip       = new NScaleStrip(new NColorFill(ENNamedColor.Beige), null, true, 0, 0, 1, 1);

            strip.Interlaced = true;
            //linearScale.Strips.Add(strip);

            // setup a bar series
            NBarSeries bar = new NBarSeries();

            bar.Name            = "Bar Series";
            bar.InflateMargins  = true;
            bar.UseXValues      = false;
            bar.LegendView.Mode = ENSeriesLegendMode.DataPoints;

            // add some data to the bar series
            bar.LegendView.Mode = ENSeriesLegendMode.DataPoints;
            bar.DataPoints.Add(new NBarDataPoint(18, "C++"));
            bar.DataPoints.Add(new NBarDataPoint(15, "Ruby"));
            bar.DataPoints.Add(new NBarDataPoint(21, "Python"));
            bar.DataPoints.Add(new NBarDataPoint(23, "Java"));
            bar.DataPoints.Add(new NBarDataPoint(27, "Javascript"));
            bar.DataPoints.Add(new NBarDataPoint(29, "C#"));
            bar.DataPoints.Add(new NBarDataPoint(26, "PHP"));
            bar.DataPoints.Add(new NBarDataPoint(17, "Objective C"));
            bar.DataPoints.Add(new NBarDataPoint(24, "SQL"));
            bar.DataPoints.Add(new NBarDataPoint(13, "Object Pascal"));
            bar.DataPoints.Add(new NBarDataPoint(19, "Visual Basic"));
            bar.DataPoints.Add(new NBarDataPoint(16, "Open Edge ABL"));

            chart.Series.Add(bar);

            return(chartView);
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Standard Heat Maps";

            // configure chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear);

            NHeatMapSeries heatMap = new NHeatMapSeries();

            chart.Series.Add(heatMap);

            NGridData data = heatMap.Data;

            heatMap.Palette = new NTwoColorPalette(NColor.Green, NColor.Red);

            int gridSizeX = 100;
            int gridSizeY = 100;

            data.Size = new NSizeI(gridSizeX, gridSizeY);

            int centerX = gridSizeX / 2;
            int centerY = gridSizeY / 2;

            int    radius = gridSizeX / 2;
            Random rand   = new Random();

            for (int y = 0; y < gridSizeY; y++)
            {
                for (int x = 0; x < gridSizeX; x++)
                {
                    int dx = x - centerX;
                    int dy = y - centerY;

                    double pointDistance = Math.Sqrt(dx * dx + dy * dy);

                    if (pointDistance < radius)
                    {
                        // assign value
                        data.SetValue(x, y, pointDistance + rand.Next(20));
                    }
                    else
                    {
                        data.SetValue(x, y, double.NaN);
                    }
                }
            }

            return(chartView);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Standard Heat Map";

            // configure chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear);

            m_HeatMap = new NHeatMapSeries();
            chart.Series.Add(m_HeatMap);

            NGridData data = m_HeatMap.Data;

            m_HeatMap.Palette = new NColorValuePalette(new NColorValuePair[] { new NColorValuePair(0.0, NColor.Purple),
                                                                               new NColorValuePair(1.5, NColor.MediumSlateBlue),
                                                                               new NColorValuePair(3.0, NColor.CornflowerBlue),
                                                                               new NColorValuePair(4.5, NColor.LimeGreen),
                                                                               new NColorValuePair(6.0, NColor.LightGreen),
                                                                               new NColorValuePair(7.5, NColor.Yellow),
                                                                               new NColorValuePair(9.0, NColor.Orange),
                                                                               new NColorValuePair(10.5, NColor.Red) });

            int gridSizeX = 100;
            int gridSizeY = 100;

            data.Size = new NSizeI(gridSizeX, gridSizeY);
            double y, x, z;

            const double dIntervalX  = 10.0;
            const double dIntervalZ  = 10.0;
            double       dIncrementX = (dIntervalX / gridSizeX);
            double       dIncrementZ = (dIntervalZ / gridSizeY);

            z = -(dIntervalZ / 2);

            for (int j = 0; j < gridSizeY; j++, z += dIncrementZ)
            {
                x = -(dIntervalX / 2);

                for (int i = 0; i < gridSizeX; i++, x += dIncrementX)
                {
                    y  = 10 - Math.Sqrt((x * x) + (z * z) + 2);
                    y += 3.0 * Math.Sin(x) * Math.Cos(z);

                    data.SetValue(i, j, y);
                }
            }

            return(chartView);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Standard Area";

            // configure chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear);

            // setup X axis
            NOrdinalScale scaleX = (NOrdinalScale)chart.Axes[ENCartesianAxis.PrimaryX].Scale;

            scaleX.InflateContentRange           = false;
            scaleX.MajorTickMode                 = ENMajorTickMode.AutoMaxCount;
            scaleX.DisplayDataPointsBetweenTicks = false;
            scaleX.Labels.Visible                = false;

            for (int i = 0; i < monthLetters.Length; i++)
            {
                scaleX.CustomLabels.Add(new NCustomValueLabel(i, monthLetters[i]));
            }

            // add interlaced stripe for Y axis
            NScaleStrip stripStyle = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;

            NLinearScale scaleY = (NLinearScale)chart.Axes[ENCartesianAxis.PrimaryY].Scale;

            scaleY.Strips.Add(stripStyle);

            // setup area series
            m_Area      = new NAreaSeries();
            m_Area.Name = "Area Series";

            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

            dataLabelStyle.Visible = true;
            dataLabelStyle.Format  = "<value>";

            m_Area.DataLabelStyle = dataLabelStyle;

            for (int i = 0; i < monthValues.Length; i++)
            {
                m_Area.DataPoints.Add(new NAreaDataPoint(monthValues[i]));
            }

            chart.Series.Add(m_Area);

            return(chartView);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "XY Scatter Area";

            // configure chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear);

            // add interlace stripe
            NLinearScale linearScale = (NLinearScale)chart.Axes[ENCartesianAxis.PrimaryY].Scale;
            NScaleStrip  stripStyle  = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            linearScale.Strips.Add(stripStyle);

            // show the x axis grid lines
            linearScale = (NLinearScale)chart.Axes[ENCartesianAxis.PrimaryX].Scale;

            NScaleGridLines majorGrid = new NScaleGridLines();

            majorGrid.Visible          = true;
            linearScale.MajorGridLines = majorGrid;

            // add the area series
            m_Area      = new NAreaSeries();
            m_Area.Name = "Area Series";

            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

            dataLabelStyle.Visible           = true;
            dataLabelStyle.ArrowStroke.Width = 0;
            dataLabelStyle.Format            = "<value>";
            m_Area.DataLabelStyle            = dataLabelStyle;

            m_Area.UseXValues = true;

            // add xy values
            m_Area.DataPoints.Add(new NAreaDataPoint(12, 10));
            m_Area.DataPoints.Add(new NAreaDataPoint(25, 23));
            m_Area.DataPoints.Add(new NAreaDataPoint(45, 12));
            m_Area.DataPoints.Add(new NAreaDataPoint(55, 24));
            m_Area.DataPoints.Add(new NAreaDataPoint(61, 16));
            m_Area.DataPoints.Add(new NAreaDataPoint(69, 19));
            m_Area.DataPoints.Add(new NAreaDataPoint(78, 17));

            chart.Series.Add(m_Area);

            return(chartView);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "XY Scatter Line";

            // configure chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear);

            // add interlaced stripe to the Y axis
            NScaleStrip stripStyle = new NScaleStrip(new NColorFill(ENNamedColor.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            chart.Axes[ENCartesianAxis.PrimaryY].Scale.Strips.Add(stripStyle);

            m_Line = new NLineSeries();
            chart.Series.Add(m_Line);

            m_Line.DataLabelStyle = new NDataLabelStyle(false);
            m_Line.InflateMargins = true;

            NMarkerStyle markerStyle = new NMarkerStyle();

            m_Line.MarkerStyle = markerStyle;

            markerStyle.Visible = true;
            markerStyle.Shape   = ENPointShape.Ellipse;
            markerStyle.Size    = new NSize(10, 10);
            markerStyle.Fill    = new NColorFill(ENNamedColor.Red);

            m_Line.Name       = "Line Series";
            m_Line.UseXValues = true;

            // add xy values
            m_Line.DataPoints.Add(new NLineDataPoint(15, 10));
            m_Line.DataPoints.Add(new NLineDataPoint(25, 23));
            m_Line.DataPoints.Add(new NLineDataPoint(45, 12));
            m_Line.DataPoints.Add(new NLineDataPoint(55, 21));
            m_Line.DataPoints.Add(new NLineDataPoint(61, 16));
            m_Line.DataPoints.Add(new NLineDataPoint(67, 19));
            m_Line.DataPoints.Add(new NLineDataPoint(72, 11));

            return(chartView);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Serialization";

            // configure chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear);

            // add interlace stripe
            NLinearScale linearScale = (NLinearScale)chart.Axes[ENCartesianAxis.PrimaryY].Scale;
            NScaleStrip  stripStyle  = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            linearScale.Strips.Add(stripStyle);

            // add the first bar
            m_Bar1                = new NBarSeries();
            m_Bar1.Name           = "Bar1";
            m_Bar1.MultiBarMode   = ENMultiBarMode.Series;
            m_Bar1.DataLabelStyle = new NDataLabelStyle(false);
            chart.Series.Add(m_Bar1);

            // add the second bar
            m_Bar2                = new NBarSeries();
            m_Bar2.Name           = "Bar2";
            m_Bar2.MultiBarMode   = ENMultiBarMode.Stacked;
            m_Bar2.DataLabelStyle = new NDataLabelStyle(false);
            chart.Series.Add(m_Bar2);

            // add the third bar
            m_Bar3                = new NBarSeries();
            m_Bar3.Name           = "Bar3";
            m_Bar3.MultiBarMode   = ENMultiBarMode.Stacked;
            m_Bar3.DataLabelStyle = new NDataLabelStyle(false);
            chart.Series.Add(m_Bar3);

            chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, false));

            FillRandomData();

            return(chartView);
        }
        /// <summary>
        /// Creates a sample bar chart given title, values and labels
        /// </summary>
        /// <param name="size"></param>
        /// <param name="title"></param>
        /// <param name="values"></param>
        /// <param name="labels"></param>
        /// <returns></returns>
        private NParagraph CreateSampleBarChart(NSize size, string title, double[] values, string[] labels)
        {
            NChartView chartView = CreateCartesianChartView();

            chartView.PreferredSize = size;

            // configure title
            chartView.Surface.Titles[0].Text        = title;
            chartView.Surface.Titles[0].Margins     = NMargins.Zero;
            chartView.Surface.Legends[0].Visibility = ENVisibility.Hidden;
            chartView.BorderThickness = NMargins.Zero;

            // configure chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            chart.Padding = new NMargins(20);

            // configure axes
            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear);
            chart.Margins = NMargins.Zero;

            NBarSeries bar = new NBarSeries();

            bar.LegendView.Mode = ENSeriesLegendMode.None;
            bar.DataLabelStyle  = new NDataLabelStyle(false);

            chart.Series.Add(bar);

            for (int i = 0; i < values.Length; i++)
            {
                bar.DataPoints.Add(new NBarDataPoint(values[i]));
            }

            NOrdinalScale scaleX = (NOrdinalScale)chart.Axes[ENCartesianAxis.PrimaryX].Scale;

            scaleX.Labels.TextProvider = new NOrdinalScaleLabelTextProvider(labels);

            NParagraph paragraph = new NParagraph();

            NWidgetInline chartInline = new NWidgetInline();

            chartInline.Content = chartView;
            paragraph.Inlines.Add(chartInline);

            return(paragraph);
        }
Example #10
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            chartView.Surface.Titles[0].Text = "Axis Strips";

            // configure chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            // configure axes
            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear);
            NLinearScale scaleY = (NLinearScale)chart.Axes[ENCartesianAxis.PrimaryY].Scale;

            // add interlaced stripe
            m_Strip            = new NScaleStrip(new NColorFill(NColor.DarkGray), null, true, 0, 0, 1, 1);
            m_Strip.Interlaced = true;
            scaleY.Strips.Add(m_Strip);

            // enable the major y grid lines
            scaleY.MajorGridLines = new NScaleGridLines();

            NOrdinalScale scaleX = (NOrdinalScale)chart.Axes[ENCartesianAxis.PrimaryX].Scale;

            // enable the major x grid lines
            scaleX.MajorGridLines = new NScaleGridLines();

            // create dummy data
            NBarSeries bar = new NBarSeries();

            bar.Name           = "Bars";
            bar.DataLabelStyle = new NDataLabelStyle(false);
            Random random = new Random();

            for (int i = 0; i < 10; i++)
            {
                bar.DataPoints.Add(new NBarDataPoint(random.Next(100)));
            }

            chart.Series.Add(bar);

            chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, false));

            return(chartView);
        }
Example #11
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Cluster Bar Labels";

            // configure chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear);

            // add interlace stripe
            NLinearScale linearScale = chart.Axes[ENCartesianAxis.PrimaryY].Scale as NLinearScale;
            NScaleStrip  strip       = new NScaleStrip(new NColorFill(ENNamedColor.Beige), null, true, 0, 0, 1, 1);

            strip.Interlaced = true;
            linearScale.Strips.Add(strip);

            // add a bar series
            m_Bar1                = new NBarSeries();
            m_Bar1.Name           = "Bar1";
            m_Bar1.MultiBarMode   = ENMultiBarMode.Series;
            m_Bar1.DataLabelStyle = CreateDataLabelStyle();
            m_Bar1.ValueFormatter = new NNumericValueFormatter("0.###");
            chart.Series.Add(m_Bar1);

            // add another bar series
            m_Bar2                = new NBarSeries();
            m_Bar2.Name           = "Bar2";
            m_Bar2.MultiBarMode   = ENMultiBarMode.Clustered;
            m_Bar2.DataLabelStyle = CreateDataLabelStyle();
            m_Bar2.ValueFormatter = new NNumericValueFormatter("0.###");
            chart.Series.Add(m_Bar2);

            FillRandomData();

            chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, false));

            return(chartView);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Standard Bar";

            // configure chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear);

            // add interlace stripe
            NLinearScale linearScale = chart.Axes[ENCartesianAxis.PrimaryY].Scale as NLinearScale;
            NScaleStrip  strip       = new NScaleStrip(new NColorFill(ENNamedColor.Beige), null, true, 0, 0, 1, 1);

            strip.Interlaced = true;
            //linearScale.Strips.Add(strip);

            // setup a bar series
            m_Bar                = new NBarSeries();
            m_Bar.Name           = "Bar Series";
            m_Bar.InflateMargins = true;
            m_Bar.UseXValues     = false;

            m_Bar.Shadow = new NShadow(NColor.LightGray, 2, 2);

            // add some data to the bar series
            m_Bar.LegendView.Mode = ENSeriesLegendMode.DataPoints;
            m_Bar.DataPoints.Add(new NBarDataPoint(18, "C++"));
            m_Bar.DataPoints.Add(new NBarDataPoint(15, "Ruby"));
            m_Bar.DataPoints.Add(new NBarDataPoint(21, "Python"));
            m_Bar.DataPoints.Add(new NBarDataPoint(23, "Java"));
            m_Bar.DataPoints.Add(new NBarDataPoint(27, "Javascript"));
            m_Bar.DataPoints.Add(new NBarDataPoint(29, "C#"));
            m_Bar.DataPoints.Add(new NBarDataPoint(26, "PHP"));

            chart.Series.Add(m_Bar);

            return(chartView);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Chart Themes";

            // configure chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear);

            // add interlace stripe
            NLinearScale linearScale = chart.Axes[ENCartesianAxis.PrimaryY].Scale as NLinearScale;
            NScaleStrip  strip       = new NScaleStrip(new NColorFill(ENNamedColor.Beige), null, true, 0, 0, 1, 1);

            strip.Interlaced = true;
            linearScale.Strips.Add(strip);

            // add a bar series
            Random random = new Random();

            for (int i = 0; i < 6; i++)
            {
                NBarSeries bar = new NBarSeries();
                bar.Name           = "Bar" + i.ToString();
                bar.MultiBarMode   = ENMultiBarMode.Clustered;
                bar.DataLabelStyle = new NDataLabelStyle(false);
                bar.ValueFormatter = new NNumericValueFormatter("0.###");
                chart.Series.Add(bar);

                for (int j = 0; j < 6; j++)
                {
                    bar.DataPoints.Add(new NBarDataPoint(random.Next(10, 100)));
                }
            }

            chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, false));

            return(chartView);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "XY Scatter Bar";

            // configure chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear);

            // add interlaced stripe to the Y axis
            NScaleStrip stripStyle = new NScaleStrip(new NColorFill(ENNamedColor.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            chart.Axes[ENCartesianAxis.PrimaryY].Scale.Strips.Add(stripStyle);

            m_Bar = new NBarSeries();
            chart.Series.Add(m_Bar);

            m_Bar.DataLabelStyle = new NDataLabelStyle(false);
            m_Bar.InflateMargins = true;
            m_Bar.WidthMode      = ENBarWidthMode.FixedWidth;
            m_Bar.Width          = 20;

            m_Bar.Name       = "Bar Series";
            m_Bar.UseXValues = true;

            // add xy values
            m_Bar.DataPoints.Add(new NBarDataPoint(15, 10));
            m_Bar.DataPoints.Add(new NBarDataPoint(25, 23));
            m_Bar.DataPoints.Add(new NBarDataPoint(45, 12));
            m_Bar.DataPoints.Add(new NBarDataPoint(55, 21));
            m_Bar.DataPoints.Add(new NBarDataPoint(61, 16));
            m_Bar.DataPoints.Add(new NBarDataPoint(67, 19));
            m_Bar.DataPoints.Add(new NBarDataPoint(72, 11));

            return(chartView);
        }
Example #15
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Standard Error Bar";

            // configure chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear);

            // add interlace stripe
            NScaleStrip stripStyle = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            chart.Axes[ENCartesianAxis.PrimaryY].Scale.Strips.Add(stripStyle);
            chart.Axes[ENCartesianAxis.PrimaryY].Scale.MajorGridLines.Visible = true;

            chart.Axes[ENCartesianAxis.PrimaryY].Scale.ViewRangeInflateMode  = ENScaleViewRangeInflateMode.MajorTick;
            chart.Axes[ENCartesianAxis.PrimaryY].Scale.InflateViewRangeBegin = true;
            chart.Axes[ENCartesianAxis.PrimaryY].Scale.InflateViewRangeEnd   = true;
            chart.Axes[ENCartesianAxis.PrimaryX].Scale.ViewRangeInflateMode  = ENScaleViewRangeInflateMode.MajorTick;
            chart.Axes[ENCartesianAxis.PrimaryX].Scale.InflateViewRangeBegin = true;
            chart.Axes[ENCartesianAxis.PrimaryX].Scale.InflateViewRangeEnd   = true;

            // add an error bar series
            m_ErrorBar = new NErrorBarSeries();
            chart.Series.Add(m_ErrorBar);
            m_ErrorBar.DataLabelStyle = new NDataLabelStyle(false);
            m_ErrorBar.Stroke         = new NStroke(NColor.Black);
            m_ErrorBar.UseXValues     = true;

            GenerateData();

            chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, false));

            return(chartView);
        }
Example #16
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Renko";

            // configure chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear);

            NLinearScale scaleY = (NLinearScale)chart.Axes[ENCartesianAxis.PrimaryY].Scale;

            // add interlace stripe
            NScaleStrip stripStyle = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            scaleY.Strips.Add(stripStyle);

            // setup X axis
            NPriceTimeScale priceScale = new NPriceTimeScale();

            priceScale.InnerMajorTicks.Stroke          = new NStroke(0.0, NColor.Black);
            chart.Axes[ENCartesianAxis.PrimaryX].Scale = priceScale;

            // setup line break series
            m_RenkoSeries            = new NRenkoSeries();
            m_RenkoSeries.BoxSize    = 1;
            m_RenkoSeries.UseXValues = true;
            chart.Series.Add(m_RenkoSeries);

            GenerateData(m_RenkoSeries);

            chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, false));

            return(chartView);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Contour Chart";

            // configure chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear);

            m_HeatMap = new NHeatMapSeries();
            chart.Series.Add(m_HeatMap);

            m_HeatMap.Palette = new NColorValuePalette(new NColorValuePair[] { new NColorValuePair(0.0, NColor.Purple),
                                                                               new NColorValuePair(1.5, NColor.MediumSlateBlue),
                                                                               new NColorValuePair(3.0, NColor.CornflowerBlue),
                                                                               new NColorValuePair(4.5, NColor.LimeGreen),
                                                                               new NColorValuePair(6.0, NColor.LightGreen),
                                                                               new NColorValuePair(7.5, NColor.Yellow),
                                                                               new NColorValuePair(9.0, NColor.Orange),
                                                                               new NColorValuePair(10.5, NColor.Red) });

/*			m_HeatMap.Palette = new NColorValuePalette(new NColorValuePair[] { new NColorValuePair(-5.0, NColor.Purple),
 *                                                      new NColorValuePair(1, NColor.MediumSlateBlue),
 *                                                      new NColorValuePair(10.0, NColor.CornflowerBlue) });*/

            m_HeatMap.ContourDisplayMode = ENContourDisplayMode.Contour;
            m_HeatMap.LegendView.Mode    = ENSeriesLegendMode.SeriesLogic;
            m_HeatMap.LegendView.Format  = "<level_value>";

            GenerateData();

            return(chartView);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Stacked Area";

            // configure chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear);

            // setup X axis
            NOrdinalScale scaleX = (NOrdinalScale)chart.Axes[ENCartesianAxis.PrimaryX].Scale;

            scaleX.InflateContentRange = false;

            // add interlaced stripe for Y axis
            NScaleStrip strip = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);

            strip.Interlaced = true;

            NLinearScale scaleY = (NLinearScale)chart.Axes[ENCartesianAxis.PrimaryY].Scale;

            scaleY.Strips.Add(strip);

            // add the first area
            m_Area1 = new NAreaSeries();
            m_Area1.MultiAreaMode  = ENMultiAreaMode.Series;
            m_Area1.Name           = "Product A";
            m_Area1.DataLabelStyle = new NDataLabelStyle();
            chart.Series.Add(m_Area1);
            SetupDataLabels(m_Area1);

            // add the second Area
            m_Area2 = new NAreaSeries();
            m_Area2.MultiAreaMode  = ENMultiAreaMode.Stacked;
            m_Area2.Name           = "Product B";
            m_Area2.DataLabelStyle = new NDataLabelStyle();
            chart.Series.Add(m_Area2);
            SetupDataLabels(m_Area2);

            // add the third Area
            m_Area3 = new NAreaSeries();
            m_Area3.MultiAreaMode  = ENMultiAreaMode.Stacked;
            m_Area3.Name           = "Product C";
            m_Area3.DataLabelStyle = new NDataLabelStyle();
            chart.Series.Add(m_Area3);
            SetupDataLabels(m_Area3);

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

            for (int i = 0; i < 10; i++)
            {
                m_Area1.DataPoints.Add(new NAreaDataPoint(random.Next(20, 50)));
                m_Area2.DataPoints.Add(new NAreaDataPoint(random.Next(20, 50)));
                m_Area3.DataPoints.Add(new NAreaDataPoint(random.Next(20, 50)));
            }

            return(chartView);
        }
        protected override NWidget CreateExampleContent()
        {
            NMemoryDataTable dataTable = new NMemoryDataTable(
                new NFieldInfo("Company", typeof(String)),
                new NFieldInfo("RegionSales", typeof(Double[])));

            Random rnd = new Random();

            for (int i = 0; i < 1000; i++)
            {
                Double[] arr = new Double[10];
                for (int j = 0; j < 10; j++)
                {
                    arr[j] = rnd.Next(100);
                }

                dataTable.AddRow(NDummyDataSource.RandomCompanyName(), arr);
            }

            // create a view and get its grid
            NTableGridView view = new NTableGridView();
            NTableGrid     grid = view.Grid;

            grid.AutoCreateColumn += delegate(NAutoCreateColumnEventArgs arg)
            {
                if (arg.DataColumn.FieldName == "RegionSales")
                {
                    NCustomColumnFormat pieColumnFormat = new NCustomColumnFormat();
                    pieColumnFormat.FormatDefaultDataCellDelegate = delegate(NDataCell theDataCell)
                    {
                        NWidget widget = new NWidget();
                        widget.PreferredSize = new NSize(400, 300);
                    };

                    pieColumnFormat.CreateValueDataCellViewDelegate = delegate(NDataCell theDataCell, object value)
                    {
                        double[] values = (double[])value;

                        NChartView chartView = new NChartView();
                        chartView.PreferredSize = new NSize(300, 60);

                        NCartesianChart cartesianChart = new NCartesianChart();

                        NDockLayout.SetDockArea(cartesianChart, ENDockArea.Center);
                        chartView.Surface.Content = cartesianChart;

                        cartesianChart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear);
                        cartesianChart.Legend = null;

                        cartesianChart.Axes[ENCartesianAxis.PrimaryX].Visible = false;
                        NCartesianAxis yAxis = cartesianChart.Axes[ENCartesianAxis.PrimaryY];

                        NValueScaleLabelStyle labelStyle = new NValueScaleLabelStyle();
                        labelStyle.TextStyle.Font = new NFont("Arimo", 8);
                        ((NLinearScale)yAxis.Scale).Labels.Style = labelStyle;

                        NBarSeries barSeries = new NBarSeries();
                        barSeries.DataLabelStyle = new NDataLabelStyle(false);
                        barSeries.InflateMargins = false;
                        cartesianChart.Series.Add(barSeries);

                        int count = values.Length;
                        for (int i = 0; i < count; i++)
                        {
                            barSeries.DataPoints.Add(new NBarDataPoint(values[i]));
                        }

                        return(chartView);
                    };

                    arg.DataColumn.Format = pieColumnFormat;
                }
            };

            grid.DataSource = new NDataSource(dataTable);
            return(view);
        }
Example #20
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Image Export Example";

            // configure chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear);

            // setup X axis
            NLinearScale xScale = (NLinearScale)chart.Axes[ENCartesianAxis.PrimaryX].Scale;

            xScale.MajorGridLines.Visible = true;

            // setup Y axis
            NLinearScale yScale = (NLinearScale)chart.Axes[ENCartesianAxis.PrimaryY].Scale;

            yScale.MajorGridLines.Visible = true;

            // add interlaced stripe
            NScaleStrip strip = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);

            strip.Interlaced = true;
            yScale.Strips.Add(strip);

            // setup shape series
            NRangeSeries range = new NRangeSeries();

            chart.Series.Add(range);

            range.DataLabelStyle = new NDataLabelStyle(false);
            range.UseXValues     = true;
            range.Fill           = new NColorFill(NColor.DarkOrange);
            range.Stroke         = new NStroke(NColor.DarkRed);

            // fill data
            double[] intervals = new double[] { 5, 5, 5, 5, 5, 5, 5, 5, 5, 15, 30, 60 };
            double[] values    = new double[] { 4180, 13687, 18618, 19634, 17981, 7190, 16369, 3212, 4122, 9200, 6461, 3435 };

            int    count = Math.Min(intervals.Length, values.Length);
            double x     = 0;

            for (int i = 0; i < count; i++)
            {
                double interval = intervals[i];
                double value    = values[i];

                double x1 = x;
                double y1 = 0;

                x += interval;
                double x2 = x;
                double y2 = value / interval;

                range.DataPoints.Add(new NRangeDataPoint(x1, y1, x2, y2));
            }

            chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, false));

            return(chartView);
        }
Example #21
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Axis Reference Lines";

            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear);

            // configure the y scale
            NLinearScale yScale = (NLinearScale)chart.Axes[ENCartesianAxis.PrimaryY].Scale;

            NScaleStrip stripStyle = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            yScale.Strips.Add(stripStyle);

            yScale.MajorGridLines.Visible = true;

            // Create a point series
            NPointSeries point = new NPointSeries();

            point.InflateMargins = true;
            point.UseXValues     = true;
            point.Name           = "Series 1";
            chart.Series.Add(point);

            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

            dataLabelStyle.Visible = false;
            point.DataLabelStyle   = dataLabelStyle;

            // Add some data
            double[] yValues = new double[] { 31, 67, 12, 84, 90 };
            double[] xValues = new double[] { 5, 36, 51, 76, 93 };

            for (int i = 0; i < yValues.Length; i++)
            {
                point.DataPoints.Add(new NPointDataPoint(xValues[i], yValues[i]));
            }

            // Add a constline for the left axis
            m_XReferenceLine        = new NAxisReferenceLine();
            m_XReferenceLine.Stroke = new NStroke(1, NColor.SteelBlue);
            m_XReferenceLine.Value  = 40;
            m_XReferenceLine.Text   = "X Reference Line";
            chart.Axes[ENCartesianAxis.PrimaryX].ReferenceLines.Add(m_XReferenceLine);

            // Add a constline for the bottom axis
            m_YReferenceLine        = new NAxisReferenceLine();
            m_YReferenceLine.Stroke = new NStroke(1, NColor.SteelBlue);
            m_YReferenceLine.Value  = 60;
            m_YReferenceLine.Text   = "Y Reference Line";
            chart.Axes[ENCartesianAxis.PrimaryY].ReferenceLines.Add(m_YReferenceLine);

            // apply style sheet
            chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, false));

            return(chartView);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            m_ChartView = new NChartView();

            NDockPanel dockPanel = new NDockPanel();

            m_ChartView.Surface.Content = dockPanel;

            NLabel label = new NLabel();

            label.Margins       = new NMargins(10);
            label.Font          = new NFont(NFontDescriptor.DefaultSansFamilyName, 12);
            label.TextFill      = new NColorFill(NColor.Black);
            label.TextAlignment = ENContentAlignment.MiddleCenter;
            label.Text          = "Aligning Chart Areas";
            NDockLayout.SetDockArea(label, ENDockArea.Top);
            dockPanel.AddChild(label);

            // configure title
            NStackPanel stackPanel = new NStackPanel();

            stackPanel.UniformHeights = ENUniformSize.Max;
            stackPanel.FillMode       = ENStackFillMode.Equal;
            stackPanel.FitMode        = ENStackFitMode.Equal;
            NDockLayout.SetDockArea(stackPanel, ENDockArea.Center);
            dockPanel.AddChild(stackPanel);

            NCartesianChart stockPriceChart = new NCartesianChart();

            stockPriceChart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XValueTimelineYLinear);
            stockPriceChart.FitMode = ENCartesianChartFitMode.Stretch;
            stockPriceChart.Margins = new NMargins(10, 0, 10, 10);
            ConfigureInteractivity(stockPriceChart);
            stackPanel.AddChild(stockPriceChart);

            // setup the stock series
            m_StockPrice = new NStockSeries();
            stockPriceChart.Series.Add(m_StockPrice);
            m_StockPrice.Name            = "Price";
            m_StockPrice.LegendView.Mode = ENSeriesLegendMode.None;
            m_StockPrice.DataLabelStyle  = new NDataLabelStyle(false);
            m_StockPrice.CandleShape     = ENCandleShape.Stick;

            m_StockPrice.UpStroke       = new NStroke(1, NColor.RoyalBlue);
            m_StockPrice.CandleWidth    = 10;
            m_StockPrice.UseXValues     = true;
            m_StockPrice.InflateMargins = false;

            // setup the volume chart
            NCartesianChart stockVolumeChart = new NCartesianChart();

            stockVolumeChart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XValueTimelineYLinear);
            stockVolumeChart.FitMode = ENCartesianChartFitMode.Stretch;
            stockVolumeChart.Margins = new NMargins(10, 0, 10, 10);
            ConfigureInteractivity(stockVolumeChart);
            stackPanel.AddChild(stockVolumeChart);

            // setup the stock volume series
            // setup the volume series
            m_StockVolume = new NAreaSeries();
            stockVolumeChart.Series.Add(m_StockVolume);
            m_StockVolume.Name            = "Volume";
            m_StockVolume.DataLabelStyle  = new NDataLabelStyle(false);
            m_StockVolume.LegendView.Mode = ENSeriesLegendMode.None;
            m_StockVolume.Fill            = new NColorFill(NColor.YellowGreen);
            m_StockVolume.UseXValues      = true;

            // make sure all axes are synchronized
            stockPriceChart.Axes[ENCartesianAxis.PrimaryX].SynchronizedAxes  = new NDomArray <NNodeRef>(new NNodeRef(stockVolumeChart.Axes[ENCartesianAxis.PrimaryX]));
            stockVolumeChart.Axes[ENCartesianAxis.PrimaryX].SynchronizedAxes = new NDomArray <NNodeRef>(new NNodeRef(stockPriceChart.Axes[ENCartesianAxis.PrimaryX]));

            GenerateData();

            // align the left parts of those charts
            NAlignmentGuidelineCollection guideLines = new NAlignmentGuidelineCollection();

            NAlignmentGuideline guideLine = new NAlignmentGuideline();

            guideLine.ContentSide = ENContentSide.Left;
            guideLine.Targets     = new NDomArray <NNodeRef>(new NNodeRef[] { new NNodeRef(stockPriceChart), new NNodeRef(stockVolumeChart) });

            guideLines.Add(guideLine);

            m_ChartView.Surface.AlignmentGuidelines = guideLines;

            m_ChartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, false));

            return(m_ChartView);
        }
Example #23
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Point And Figure";

            // configure chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear);

            // setup X axis
            NPriceTimeScale priceScale = new NPriceTimeScale();

            priceScale.InnerMajorTicks.Stroke          = new NStroke(0.0, NColor.Black);
            chart.Axes[ENCartesianAxis.PrimaryX].Scale = priceScale;

            const int nInitialBoxSize = 5;

            // setup Y axis
            NLinearScale scaleY = (NLinearScale)chart.Axes[ENCartesianAxis.PrimaryY].Scale;

            scaleY.MajorTickMode         = ENMajorTickMode.CustomStep;
            scaleY.CustomStep            = nInitialBoxSize;
            scaleY.OuterMajorTicks.Width = 0;
            scaleY.InnerMajorTicks.Width = 0;
            scaleY.AutoMinorTicks        = true;
            scaleY.MinorTickCount        = 1;
            scaleY.InflateViewRangeBegin = false;
            scaleY.InflateViewRangeEnd   = false;
            scaleY.MajorGridLines.Stroke = new NStroke(0, NColor.Black);
            scaleY.MinorGridLines.Stroke = new NStroke(1, NColor.Black);

            float[] highValues = new float[20] {
                21.3F, 42.4F, 11.2F, 65.7F, 38.0F, 71.3F, 49.54F, 83.7F, 13.9F, 56.12F, 27.43F, 23.1F, 31.0F, 75.4F, 9.3F, 39.12F, 10.0F, 44.23F, 21.76F, 49.2F
            };
            float[] lowValues = new float[20] {
                12.1F, 14.32F, 8.43F, 36.0F, 13.5F, 47.34F, 24.54F, 68.11F, 6.87F, 23.3F, 12.12F, 14.54F, 25.0F, 37.2F, 3.9F, 23.11F, 1.9F, 14.0F, 8.23F, 34.21F
            };

            // setup Point & Figure series
            m_PointAndFigure            = new NPointAndFigureSeries();
            m_PointAndFigure.UseXValues = true;
            chart.Series.Add(m_PointAndFigure);

            DateTime dt = DateTime.Now;

            // fill data
            int count = highValues.Length;

            for (int i = 0; i < count; i++)
            {
                m_PointAndFigure.DataPoints.Add(new NPointAndFigureDataPoint(NDateTimeHelpers.ToOADate(dt), highValues[i], lowValues[i]));
                dt = dt.AddDays(1);
            }

            chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, false));

            return(chartView);
        }
Example #24
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Interactive Legend";

            // configure chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear);

            // add interlace stripe
            NLinearScale linearScale = (NLinearScale)chart.Axes[ENCartesianAxis.PrimaryY].Scale;
            NScaleStrip  stripStyle  = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            linearScale.Strips.Add(stripStyle);

            // add the first bar
            NBarSeries bar1 = new NBarSeries();

            bar1.Name            = "Bar1";
            bar1.MultiBarMode    = ENMultiBarMode.Series;
            bar1.LegendView.Mode = ENSeriesLegendMode.SeriesVisibility;
            chart.Series.Add(bar1);

            // add the second bar
            NBarSeries bar2 = new NBarSeries();

            bar2.Name            = "Bar2";
            bar2.MultiBarMode    = ENMultiBarMode.Stacked;
            bar2.LegendView.Mode = ENSeriesLegendMode.SeriesVisibility;
            chart.Series.Add(bar2);

            // add the third bar
            NBarSeries bar3 = new NBarSeries();

            bar3.Name            = "Bar3";
            bar3.MultiBarMode    = ENMultiBarMode.Stacked;
            bar3.LegendView.Mode = ENSeriesLegendMode.SeriesVisibility;
            chart.Series.Add(bar3);

            // setup value formatting
            bar1.ValueFormatter = new NNumericValueFormatter("0.###");
            bar2.ValueFormatter = new NNumericValueFormatter("0.###");
            bar3.ValueFormatter = new NNumericValueFormatter("0.###");

            // position data labels in the center of the bars
            bar1.DataLabelStyle = CreateDataLabelStyle();
            bar2.DataLabelStyle = CreateDataLabelStyle();
            bar3.DataLabelStyle = CreateDataLabelStyle();

            chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, false));

            // pass some random data
            Random random = new Random();

            for (int i = 0; i < 12; i++)
            {
                bar1.DataPoints.Add(new NBarDataPoint(random.Next(90) + 10));
                bar2.DataPoints.Add(new NBarDataPoint(random.Next(90) + 10));
                bar3.DataPoints.Add(new NBarDataPoint(random.Next(90) + 10));
            }


            return(chartView);
        }