Beispiel #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
            nChartControl1.Settings.JitterMode = JitterMode.Enabled;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Clustered Float Bar");

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

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

            chart.Enable3D = true;
            chart.Axis(StandardAxis.Depth).Visible = false;
            chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);

            // setup X axis
            NOrdinalScaleConfigurator scaleX = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator;

            scaleX.MajorTickMode = MajorTickMode.AutoMaxCount;

            // add interlace stripe
            NLinearScaleConfigurator scaleY     = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;
            NScaleStripStyle         stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced  = true;
            stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Left };
            scaleY.StripStyles.Add(stripStyle);

            // setup the bar series
            NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar.Name = "Bar";
            bar.DataLabelStyle.Visible = false;
            bar.Values.FillRandomRange(Random, 8, 7, 15);

            // setup the floatbar series
            NFloatBarSeries floatbar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar);

            floatbar.MultiFloatBarMode = MultiFloatBarMode.Clustered;
            floatbar.Name = "Floatbar";
            floatbar.DataLabelStyle.Visible = false;

            floatbar.AddDataPoint(new NFloatBarDataPoint(3.1, 5.2));
            floatbar.AddDataPoint(new NFloatBarDataPoint(4.0, 6.1));
            floatbar.AddDataPoint(new NFloatBarDataPoint(2.0, 6.4));
            floatbar.AddDataPoint(new NFloatBarDataPoint(5.3, 7.3));
            floatbar.AddDataPoint(new NFloatBarDataPoint(3.8, 8.4));
            floatbar.AddDataPoint(new NFloatBarDataPoint(4.0, 7.7));
            floatbar.AddDataPoint(new NFloatBarDataPoint(2.9, 4.1));
            floatbar.AddDataPoint(new NFloatBarDataPoint(5.0, 7.2));

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

            styleSheet.Apply(nChartControl1.Document);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]);
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("DateTime Smooth Line");

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

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

            // setup chart
            NChart chart = nChartControl1.Charts[0];

            chart.BoundsMode = BoundsMode.Stretch;

            // setup X axis
            NDateTimeScaleConfigurator scaleX = new NDateTimeScaleConfigurator();

            scaleX.EnableUnitSensitiveFormatting = false;
            scaleX.LabelValueFormatter           = new NDateTimeValueFormatter("dd MMM");
            scaleX.LabelStyle.Angle = new NScaleLabelAngle(90);
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX;

            // setup Y axis
            NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;

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

            // add interlace stripe
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced  = true;
            stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
            scaleY.StripStyles.Add(stripStyle);

            // add the line
            NSmoothLineSeries line = (NSmoothLineSeries)chart.Series.Add(SeriesType.SmoothLine);

            line.Name                           = "Smooth Line";
            line.InflateMargins                 = true;
            line.DataLabelStyle.Visible         = false;
            line.MarkerStyle.Visible            = true;
            line.MarkerStyle.PointShape         = PointShape.Cylinder;
            line.MarkerStyle.AutoDepth          = false;
            line.MarkerStyle.Width              = new NLength(1.4f, NRelativeUnit.ParentPercentage);
            line.MarkerStyle.Height             = new NLength(1.4f, NRelativeUnit.ParentPercentage);
            line.MarkerStyle.Depth              = new NLength(1.4f, NRelativeUnit.ParentPercentage);
            line.UseXValues                     = true;
            line.UseZValues                     = false;
            line.Use1DInterpolationForXYScatter = true;

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

            styleSheet.Apply(nChartControl1.Document);

            GenreateYValues(nValuesCount);
            GenreateXValues(nValuesCount);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                WebExamplesUtilities.FillComboWithColorNames(UpColorDropDownList, KnownColor.Black);
                WebExamplesUtilities.FillComboWithColorNames(DownColorDropDownList, KnownColor.Black);
                WebExamplesUtilities.FillComboWithValues(UpStrokeDropDownList, 1, 3, 1);
                UpStrokeDropDownList.SelectedIndex = 1;
                WebExamplesUtilities.FillComboWithValues(DownStrokeDropDownList, 1, 3, 1);
                reversalAmountDropdownlist.Items.AddRange(new ListItem[]
                                                          { new ListItem("0.5"),
                                                            new ListItem("1"),
                                                            new ListItem("2"),
                                                            new ListItem("1%"),
                                                            new ListItem("2%"),
                                                            new ListItem("5%") });
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

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

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

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

            NChart chart = nChartControl1.Charts[0];

            chart.BoundsMode = BoundsMode.Stretch;

            // setup X axis
            NPriceScaleConfigurator priceConfigurator = new NPriceScaleConfigurator();

            priceConfigurator.InnerMajorTickStyle.LineStyle.Width = new NLength(0);
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator   = priceConfigurator;

            // setup Y axis
            NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;
            NScaleStripStyle         stripStyle  = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.StripStyles.Add(stripStyle);

            //Setup Kagi series
            NKagiSeries kagi = (NKagiSeries)chart.Series.Add(SeriesType.Kagi);

            kagi.UpStrokeStyle.Color   = WebExamplesUtilities.ColorFromDropDownList(UpColorDropDownList);
            kagi.DownStrokeStyle.Color = WebExamplesUtilities.ColorFromDropDownList(DownColorDropDownList);
            kagi.UpStrokeStyle.Width   = new NLength(Convert.ToInt32(UpStrokeDropDownList.SelectedValue));
            kagi.DownStrokeStyle.Width = new NLength(Convert.ToInt32(DownStrokeDropDownList.SelectedValue));
            kagi.UseXValues            = true;

            switch (reversalAmountDropdownlist.SelectedIndex)
            {
            case 0:
                kagi.ReversalAmount           = 0.5;
                kagi.ReversalAmountInPercents = false;
                break;

            case 1:
                kagi.ReversalAmount           = 1;
                kagi.ReversalAmountInPercents = false;
                break;

            case 2:
                kagi.ReversalAmount           = 2;
                kagi.ReversalAmountInPercents = false;
                break;

            case 3:
                kagi.ReversalAmount           = 1;
                kagi.ReversalAmountInPercents = true;
                break;

            case 4:
                kagi.ReversalAmount           = 2;
                kagi.ReversalAmountInPercents = true;
                break;

            case 5:
                kagi.ReversalAmount           = 5;
                kagi.ReversalAmountInPercents = true;
                break;
            }

            GenerateData(kagi);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
Beispiel #4
0
        public override void Initialize()
        {
            base.Initialize();

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Real Time Point");

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

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

            // do not update automatic legends
            nChartControl1.ServiceManager.LegendUpdateService.UpdateAutoLegends();
            nChartControl1.ServiceManager.LegendUpdateService.Stop();

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

            chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted);
            chart.BoundsMode = BoundsMode.Fit;
            chart.Enable3D   = true;

            // make the aspect 1:1:1
            chart.Width  = 50.0f;
            chart.Height = 50.0f;
            chart.Depth  = 50.0f;

            // configure the y axis
            NAxis yAxis = chart.Axis(StandardAxis.PrimaryY);
            NLinearScaleConfigurator linearScale = yAxis.ScaleConfigurator as NLinearScaleConfigurator;

            // add interlace stripe
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.StripStyles.Add(stripStyle);

            linearScale.MajorGridStyle.LineStyle.Color = Color.LightSteelBlue;
            linearScale.InnerMinorTickStyle.Visible    = false;
            linearScale.InnerMajorTickStyle.Visible    = false;
            linearScale.LabelFitModes = new LabelFitMode[0];

            // configure the axes
            ConfigureAxis(chart.Axis(StandardAxis.PrimaryX));
            ConfigureAxis(chart.Axis(StandardAxis.PrimaryY));
            ConfigureAxis(chart.Axis(StandardAxis.Depth));

            // apply layout
            ConfigureStandardLayout(chart, title, null);

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

            styleSheet.Apply(nChartControl1.Document);

            DataPointsPerSphereComboBox.Items.Add("100");
            DataPointsPerSphereComboBox.Items.Add("1000");
            DataPointsPerSphereComboBox.Items.Add("10000");
            DataPointsPerSphereComboBox.SelectedIndex = 0;

            UseHardwareAccelerationCheckBox.Checked = true;
            StartTimer();
        }
Beispiel #5
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // init form controls
            if (!IsPostBack)
            {
                AngleModeDropDownList.Items.Add("View");
                AngleModeDropDownList.Items.Add("Scale");
                AngleModeDropDownList.SelectedIndex = 1;

                AllowFlipCheckBox.Checked   = false;
                FitAxisContentInBox.Checked = true;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
            nChartControl1.Settings.JitterMode = JitterMode.Enabled;
            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel header = new NLabel("Axis Labels Orientation");

            nChartControl1.Panels.Add(header);
            header.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            header.Margins  = new NMarginsL(10, 10, 10, 4);
            header.DockMode = PanelDockMode.Top;

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

            nChartControl1.Panels.Add(chart);
            chart.Enable3D            = true;
            chart.Fit3DAxisContent    = FitAxisContentInBox.Checked;
            chart.DockMode            = PanelDockMode.Fill;
            chart.BorderStyle         = new NStrokeBorderStyle(BorderShape.RoundedRect);
            chart.BackgroundFillStyle = new NGradientFillStyle(Color.White, Color.LightGray);
            chart.Margins             = new NMarginsL(10, 0, 10, 10);
            chart.Padding             = new NMarginsL(2, 2, 2, 2);

            // set predefined projection and lighting
            chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.MetallicLustre);

            chart.Depth      = 50;
            chart.Width      = 50;
            chart.Height     = 50;
            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(80, NRelativeUnit.ParentPercentage));

            // add interlaced stripe
            NStandardScaleConfigurator scaleConfiguratorY = (NStandardScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;
            NScaleStripStyle           stripStyle         = new NScaleStripStyle();

            stripStyle.FillStyle = new NColorFillStyle(Color.Beige);
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            stripStyle.Interlaced = true;
            scaleConfiguratorY.StripStyles.Add(stripStyle);

            // add series
            Color[] seriesColors   = new Color[] { Color.Crimson, Color.Orange, Color.OliveDrab };
            int     dataItemsCount = 6;

            for (int i = 0; i < seriesColors.Length; i++)
            {
                NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar);

                bar.BarShape  = BarShape.SmoothEdgeBar;
                bar.FillStyle = new NColorFillStyle(seriesColors[i]);
                bar.Name      = "Series " + i.ToString();
                bar.Values.FillRandomRange(Random, dataItemsCount, 10, 30);
                bar.InflateMargins         = true;
                bar.DataLabelStyle.Visible = false;
            }

            // configure the x axis labels (categories)
            NOrdinalScaleConfigurator ordinalScale = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;

            ordinalScale.AutoLabels    = false;
            ordinalScale.Title.Text    = "Categories Title";
            ordinalScale.MajorTickMode = MajorTickMode.CustomStep;
            ordinalScale.LabelFitModes = new LabelFitMode[] { LabelFitMode.Stagger2, LabelFitMode.AutoScale };

            for (int i = 0; i < dataItemsCount; i++)
            {
                ordinalScale.Labels.Add("S" + i.ToString());
            }

            // configure the depth axis labels (series)
            ordinalScale               = chart.Axis(StandardAxis.Depth).ScaleConfigurator as NOrdinalScaleConfigurator;
            ordinalScale.AutoLabels    = false;
            ordinalScale.Title.Text    = "Series Title";
            ordinalScale.MajorTickMode = MajorTickMode.CustomStep;
            ordinalScale.Labels.Add("S1");
            ordinalScale.Labels.Add("S2");
            ordinalScale.Labels.Add("S3");
            ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            ordinalScale.LabelFitModes = new LabelFitMode[] { LabelFitMode.Stagger2, LabelFitMode.AutoScale };

            // set title to Y axis
            NNumericScaleConfigurator numericScale = chart.Axis((int)StandardAxis.PrimaryY).ScaleConfigurator as NNumericScaleConfigurator;

            numericScale.Title.Text = "Values";

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

            styleSheet.Apply(nChartControl1.Document);

            // read the form control values
            float customAngle;

            if (!float.TryParse(CustomAngleTextBox.Text, out customAngle) || customAngle < 0 || customAngle > 360)
            {
                customAngle             = 0f;
                CustomAngleTextBox.Text = customAngle.ToString();
            }

            // update scale labels angle
            int count = chart.Axes.Count;

            NScaleLabelAngle angle = new NScaleLabelAngle((ScaleLabelAngleMode)Enum.Parse(typeof(ScaleLabelAngleMode), AngleModeDropDownList.SelectedItem.Value),
                                                          customAngle,
                                                          AllowFlipCheckBox.Checked);

            // update the x axis
            NAxis axis = (NAxis)chart.Axes[(int)StandardAxis.PrimaryX];
            NStandardScaleConfigurator scale = axis.ScaleConfigurator as NStandardScaleConfigurator;

            scale.LabelStyle.Angle = angle;

            // update the depth axis
            axis  = (NAxis)chart.Axes[(int)StandardAxis.Depth];
            scale = axis.ScaleConfigurator as NStandardScaleConfigurator;
            scale.LabelStyle.Angle = angle;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            NThinChartControl1.StateId = "Chart1";

            if (!NThinChartControl1.Initialized)
            {
                // enable jittering (full scene antialiasing)
                NThinChartControl1.Settings.JitterMode            = JitterMode.Enabled;
                NThinChartControl1.ServerSettings.EnableTiledZoom = true;
                NThinChartControl1.Panels.Clear();

                // apply background image border
                NImageFrameStyle frame = new NImageFrameStyle();
                frame.Type              = ImageFrameType.Raised;
                frame.BackgroundColor   = Color.White;
                frame.BorderStyle.Color = Color.Gainsboro;
                NThinChartControl1.BackgroundStyle.FrameStyle = frame;
                NThinChartControl1.BackgroundStyle.FillStyle  = new NGradientFillStyle(Color.White, Color.GhostWhite);

                // set a chart title
                NLabel title = new NLabel("Toolbar Configuration");
                NThinChartControl1.Panels.Add(title);
                title.DockMode                   = PanelDockMode.Top;
                title.Padding                    = new NMarginsL(4, 6, 4, 6);
                title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
                title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;

                // configure the legend
                NLegend legend = new NLegend();
                NThinChartControl1.Panels.Add(legend);
                legend.DockMode = PanelDockMode.Right;
                legend.Padding  = new NMarginsL(1, 1, 3, 3);
                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.HorizontalBorderStyle.Width  = new NLength(0, NGraphicsUnit.Pixel);
                legend.VerticalBorderStyle.Width    = new NLength(0, NGraphicsUnit.Pixel);

                // configure the chart
                NCartesianChart chart = new NCartesianChart();
                NThinChartControl1.Panels.Add(chart);
                chart.Enable3D         = true;
                chart.Fit3DAxisContent = true;
                chart.DisplayOnLegend  = legend;
                chart.BoundsMode       = BoundsMode.Fit;
                chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
                chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1);
                chart.DockMode = PanelDockMode.Fill;
                chart.Padding  = new NMarginsL(
                    new NLength(3, NRelativeUnit.ParentPercentage),
                    new NLength(3, NRelativeUnit.ParentPercentage),
                    new NLength(3, NRelativeUnit.ParentPercentage),
                    new NLength(3, NRelativeUnit.ParentPercentage));
                chart.Wall(ChartWallType.Back).FillStyle = new NGradientFillStyle(Color.White, Color.Gray);

                // setup the X axis
                NAxis axisX = chart.Axis(StandardAxis.PrimaryX);
                axisX.ScrollBar.Visible = true;
                NOrdinalScaleConfigurator scaleX = (NOrdinalScaleConfigurator)axisX.ScaleConfigurator;
                scaleX.MajorTickMode = MajorTickMode.AutoMaxCount;
                scaleX.AutoLabels    = false;

                // add interlaced stripe for the Y axis
                NAxis axisY = chart.Axis(StandardAxis.PrimaryY);
                axisY.ScrollBar.Visible = true;
                NLinearScaleConfigurator scaleY     = (NLinearScaleConfigurator)axisY.ScaleConfigurator;
                NScaleStripStyle         stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);
                stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Left };
                scaleY.StripStyles.Add(stripStyle);

                // hide the depth axis
                chart.Axis(StandardAxis.Depth).Visible = false;

                // add a bar series and fill it with data
                NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar);
                bar.Name        = "Simple Bar Chart";
                bar.BarShape    = BarShape.SmoothEdgeBar;
                bar.Legend.Mode = SeriesLegendMode.DataPoints;
                bar.Legend.TextStyle.FontStyle.EmSize = new NLength(8, NGraphicsUnit.Point);
                bar.DataLabelStyle.Visible            = false;

                AddDataPoint(scaleX, bar, 16, "Spain", @"http://en.wikipedia.org/wiki/Spain");
                AddDataPoint(scaleX, bar, 42, "France", @"http://en.wikipedia.org/wiki/France");
                AddDataPoint(scaleX, bar, 56, "Germany", @"http://en.wikipedia.org/wiki/Germany");
                AddDataPoint(scaleX, bar, 23, "Italy", @"http://en.wikipedia.org/wiki/Italy");
                AddDataPoint(scaleX, bar, 47, "UK", @"http://en.wikipedia.org/wiki/UK");
                AddDataPoint(scaleX, bar, 38, "Sweden", @"http://en.wikipedia.org/wiki/Sweden");

                // add the index of the bar to highlight
                NThinChartControl1.CustomData = 0;

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

                // configure toolbar
                NThinChartControl1.Toolbar.Visible = true;
                NThinChartControl1.Controller.SetActivePanel(chart);

                NThinChartControl1.AutoUpdateCallback = new NAutoUpdateCallback();

                //NThinChartControl1.Controller.EnableAutoUpdate = true;
                NTrackballTool tbt = new NTrackballTool();
                tbt.Exclusive = true;
                tbt.Enabled   = true;
                NThinChartControl1.Controller.Tools.Add(tbt);

                // add a data zoom tool
                NDataZoomTool dataZoomTool = new NDataZoomTool();
                dataZoomTool.Exclusive = true;
                dataZoomTool.Enabled   = false;
                NThinChartControl1.Controller.Tools.Add(dataZoomTool);

                // add a data pan tool
                NDataPanTool dataPanTool = new NDataPanTool();
                dataPanTool.Exclusive = true;
                dataPanTool.Enabled   = false;
                NThinChartControl1.Controller.Tools.Add(dataPanTool);

                // add a tooltip tool
                NThinChartControl1.Controller.Tools.Add(new NTooltipTool());
                // add a cursor change tool
                NThinChartControl1.Controller.Tools.Add(new NCursorTool());
                // add a browser redirect tool
                NThinChartControl1.Controller.Tools.Add(new NBrowserRedirectTool());

                NThinChartControl1.Toolbar.Visible = true;
                NThinChartControl1.Toolbar.Items.Add(new NToolbarButton(new NSaveStateAction()));
                NThinChartControl1.Toolbar.Items.Add(new NToolbarButton(new NSaveImageAction("Save as PDF", new NPdfImageFormat(), true, new NSize(), 300)));
                NThinChartControl1.Toolbar.Items.Add(new NToolbarButton(new NSaveImageAction("Save as SVG", new NSvgImageFormat(), true, new NSize(), 96)));
                NThinChartControl1.Toolbar.Items.Add(new NToolbarButton(new NSaveImageAction("Save as XAML", new NXamlImageFormat(), true, new NSize(), 96)));

                NSaveImageAction sia = new NSaveImageAction("Bitmap.bmp", new NBitmapImageFormat(), true, new NSize(), 96);
                sia.Tooltip = "Print or Save as Bitmap";
                NThinChartControl1.Toolbar.Items.Add(new NToolbarButton(sia));
                NThinChartControl1.Toolbar.Items.Add(new NToolbarSeparator());

                NThinChartControl1.Toolbar.Items.Add(new NToolbarButton(new NTogglePanelSelectorToolAction()));
                NThinChartControl1.Toolbar.Items.Add(new NToolbarButton(new NToggleDataZoomToolAction()));
                NThinChartControl1.Toolbar.Items.Add(new NToolbarButton(new NToggleDataPanToolAction()));
                NThinChartControl1.Toolbar.Items.Add(new NToolbarButton(new NToggleTrackballToolAction()));
                NThinChartControl1.Toolbar.Items.Add(new NToolbarSeparator());

                NThinChartControl1.Toolbar.Items.Add(new NToolbarButton(new NToggleAutoUpdateAction()));
                NThinChartControl1.Toolbar.Items.Add(new NToolbarButton(new NToggleChart3DAction()));
                NThinChartControl1.Toolbar.Items.Add(new NToolbarButton(new NToggleChartLightingAction()));
                NThinChartControl1.Toolbar.Items.Add(new NToolbarSeparator());

                NThinChartControl1.Toolbar.Items.Add(new NToolbarButton(new NToggleTooltipToolAction()));
                NThinChartControl1.Toolbar.Items.Add(new NToolbarButton(new NToggleBrowserRedirectToolAction()));
                NThinChartControl1.Toolbar.Items.Add(new NToolbarButton(new NToggleCursorToolAction()));
                NThinChartControl1.Toolbar.Items.Add(new NToolbarSeparator());

                NThinChartControl1.Toolbar.Items.Add(new NToolbarButton(new ShowDataLabelsAction()));
                NThinChartControl1.Toolbar.Items.Add(new NToolbarButton(new HideDataLabelsAction()));

                NThinChartControl1.CustomRequestCallback = new CustomRequestCallback();
            }
        }
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Stick Stock Chart");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);
            title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue);

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

            // setup chart
            NChart chart = nChartControl1.Charts[0];

            // setup X axis
            NValueTimelineScaleConfigurator scaleX = new NValueTimelineScaleConfigurator();

            scaleX.FirstRow.GridStyle.ShowAtWalls   = new ChartWallType[] { ChartWallType.Back };
            scaleX.FirstRow.GridStyle.LineStyle     = new NStrokeStyle(1, Color.FromArgb(225, 225, 225));
            scaleX.FirstRow.UseGridStyle            = true;
            scaleX.FirstRow.InnerTickStyle.Visible  = false;
            scaleX.SecondRow.GridStyle.ShowAtWalls  = new ChartWallType[] { ChartWallType.Back };
            scaleX.SecondRow.GridStyle.LineStyle    = new NStrokeStyle(1, Color.FromArgb(215, 215, 215));
            scaleX.SecondRow.UseGridStyle           = true;
            scaleX.SecondRow.InnerTickStyle.Visible = false;
            scaleX.ThirdRow.GridStyle.ShowAtWalls   = new ChartWallType[] { ChartWallType.Back };
            scaleX.ThirdRow.GridStyle.LineStyle     = new NStrokeStyle(1, Color.FromArgb(205, 205, 205));
            scaleX.ThirdRow.UseGridStyle            = true;
            scaleX.ThirdRow.InnerTickStyle.Visible  = false;
            // calendar
            NWeekDayRule wdr = new NWeekDayRule(WeekDayBit.All);

            wdr.Saturday = false;
            wdr.Sunday   = false;
            scaleX.Calendar.Rules.Add(wdr);
            scaleX.EnableCalendar = true;
            // set configurator
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX;

            // setup Y axis
            NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;

            scaleY.OuterMajorTickStyle.Length  = new NLength(3, NGraphicsUnit.Point);
            scaleY.InnerMajorTickStyle.Visible = false;

            NFillStyle       stripFill  = new NColorFillStyle(Color.FromArgb(234, 233, 237));
            NScaleStripStyle stripStyle = new NScaleStripStyle(stripFill, null, true, 1, 0, 1, 1);

            stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
            stripStyle.Interlaced  = true;
            scaleY.StripStyles.Add(stripStyle);

            // add a stock series
            m_Stock                        = (NStockSeries)chart.Series.Add(SeriesType.Stock);
            m_Stock.CandleStyle            = CandleStyle.Stick;
            m_Stock.DataLabelStyle.Visible = false;
            m_Stock.UpStrokeStyle.Width    = new NLength(1, NGraphicsUnit.Point);
            m_Stock.UpStrokeStyle.Color    = Color.Black;
            m_Stock.DownStrokeStyle.Width  = new NLength(1, NGraphicsUnit.Point);
            m_Stock.DownStrokeStyle.Color  = Color.Crimson;
            m_Stock.CandleWidth            = new NLength(1.3f, NRelativeUnit.ParentPercentage);
            m_Stock.UseXValues             = true;
            m_Stock.InflateMargins         = true;

            // add some stock items
            const int count = 50;

            GenerateOHLCData(m_Stock, 100.0, count, new NRange1DD(60, 140));
            FillStockDates(m_Stock, count);

            // apply layout
            ConfigureStandardLayout(chart, title, null);

            // init form controls
            ShowHighLowCheckBox.IsChecked = true;
            ShowOpenCheckBox.IsChecked    = true;
            ShowCloseCheckBox.IsChecked   = true;
        }
Beispiel #8
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("XYZ Error Bar");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);
            title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue);

            // remove the legend
            nChartControl1.Legends.Clear();

            // setup chart
            m_Chart          = nChartControl1.Charts[0];
            m_Chart.Enable3D = true;
            m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted);
            m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
            m_Chart.BoundsMode       = BoundsMode.Fit;
            m_Chart.ContentAlignment = ContentAlignment.BottomRight;
            m_Chart.Location         = new NPointL(new NLength(8, NRelativeUnit.ParentPercentage), new NLength(8, NRelativeUnit.ParentPercentage));
            m_Chart.Size             = new NSizeL(new NLength(84, NRelativeUnit.ParentPercentage), new NLength(84, NRelativeUnit.ParentPercentage));
            m_Chart.Depth            = 55.0f;
            m_Chart.Width            = 55.0f;
            m_Chart.Height           = 55.0f;

            // setup the x axis
            NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator();

            m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale;
            linearScale.MajorGridStyle.LineStyle.Pattern          = LinePattern.Dot;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);

            // setup the y axis
            linearScale = new NLinearScaleConfigurator();
            m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale;
            linearScale.MajorGridStyle.LineStyle.Pattern          = LinePattern.Dot;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);

            // add interlace stripe
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.StripStyles.Add(stripStyle);

            // setup the z axis
            linearScale = new NLinearScaleConfigurator();
            m_Chart.Axis(StandardAxis.Depth).ScaleConfigurator = linearScale;

            linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true);

            // add an error bar series
            NErrorBarSeries series = (NErrorBarSeries)m_Chart.Series.Add(SeriesType.ErrorBar);

            series.DataLabelStyle.Visible  = false;
            series.BorderStyle             = new NStrokeStyle(GreyBlue);
            series.MarkerStyle.Visible     = true;
            series.MarkerStyle.AutoDepth   = false;
            series.MarkerStyle.FillStyle   = new NColorFillStyle(DarkOrange);
            series.MarkerStyle.BorderStyle = new NStrokeStyle(GreyBlue);
            series.MarkerStyle.Width       = new NLength(1.2f, NRelativeUnit.ParentPercentage);
            series.MarkerStyle.Height      = new NLength(1.2f, NRelativeUnit.ParentPercentage);
            series.MarkerStyle.Depth       = new NLength(1.2f, NRelativeUnit.ParentPercentage);
            series.UseXValues      = true;
            series.UseZValues      = true;
            series.ShowLowerErrorX = true;
            series.ShowLowerErrorY = true;
            series.ShowLowerErrorZ = true;
            series.ShowUpperErrorX = true;
            series.ShowUpperErrorY = true;
            series.ShowUpperErrorZ = true;

            GenerateData(series);

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

            // apply layout
            ConfigureStandardLayout(m_Chart, title, null);
        }
Beispiel #9
0
        public override void Initialize()
        {
            base.Initialize();

            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel title = new NLabel("Animation Themes");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);
            title.DockMode            = PanelDockMode.Top;
            title.Margins             = new NMarginsL(0, 10, 0, 0);
            nChartControl1.Panels.Add(title);

            NDockPanel contentPanel = new NDockPanel();

            nChartControl1.Panels.Add(contentPanel);

            contentPanel.DockMode = PanelDockMode.Fill;

            // configure the chart
            NCartesianChart chart = new NCartesianChart();

            contentPanel.ChildPanels.Add(chart);
            chart.Location = new NPointL(0, 0);
            chart.Size     = new NSizeL(new NLength(100, NRelativeUnit.ParentPercentage),
                                        new NLength(60, NRelativeUnit.ParentPercentage));
            chart.Enable3D = false;
            chart.Axis(StandardAxis.Depth).Visible = false;
            chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.BrightCameraLight);
            chart.Margins    = new NMarginsL(10, 10, 10, 10);
            chart.BoundsMode = BoundsMode.Stretch;
            chart.DockMode   = PanelDockMode.Top;

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

            chart.ChildPanels.Add(legend);
            chart.DisplayOnLegend = legend;
            chart.PositionChildPanelsInContentBounds = true;
            legend.DockMode     = PanelDockMode.Top;
            legend.FitAlignment = ContentAlignment.BottomRight;
            legend.Location     = new NPointL(new NLength(100, NRelativeUnit.ParentPercentage), new NLength(0));
            legend.Margins      = new NMarginsL(0, 5, 5, 0);
            legend.OuterLeftBorderStyle.Width   = new NLength(0);
            legend.OuterRightBorderStyle.Width  = new NLength(0);
            legend.OuterTopBorderStyle.Width    = new NLength(0);
            legend.OuterBottomBorderStyle.Width = new NLength(0);
            legend.VerticalBorderStyle.Width    = new NLength(0);
            legend.FillStyle.SetTransparencyPercent(50);

            // configure axes
            NOrdinalScaleConfigurator ordinalScale = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;

            ordinalScale.AutoLabels = false;
            ordinalScale.Labels.Add("2004");
            ordinalScale.Labels.Add("2005");
            ordinalScale.Labels.Add("2006");
            ordinalScale.Labels.Add("2007");
            ordinalScale.Labels.Add("2008");
            ordinalScale.Labels.Add("2009");

            // add interlace stripe
            NLinearScaleConfigurator linearScale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;

            linearScale.Title.Text = "Sales in Thousands USD";
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.StripStyles.Add(stripStyle);

            NDockPanel gaugesPanel = new NDockPanel();

            gaugesPanel.DockMode = PanelDockMode.Fill;
            gaugesPanel.Margins  = new NMarginsL(20, 0, 10, 0);
            gaugesPanel.PositionChildPanelsInContentBounds = true;
            contentPanel.ChildPanels.Add(gaugesPanel);

            string[] companyNames = new string[] { "Company A", "Company B", "Company C" };

            for (int i = 0; i < 3; i++)
            {
                NDockPanel gaugeContainer = new NDockPanel();
                gaugeContainer.Location = new NPointL(new NLength(i * 35, NRelativeUnit.ParentPercentage),
                                                      new NLength(0));
                gaugeContainer.Size = new NSizeL(new NLength(30, NRelativeUnit.ParentPercentage),
                                                 new NLength(100, NRelativeUnit.ParentPercentage));

                gaugeContainer.ChildPanels.Add(CreateGaugeLabel(companyNames[i]));
                gaugeContainer.ChildPanels.Add(CreateGauge());

                gaugesPanel.ChildPanels.Add(gaugeContainer);
            }

            // init form controls
            ChartTypeCombo.Items.Add("Bar");
            ChartTypeCombo.Items.Add("Line");
            ChartTypeCombo.Items.Add("Area");
            ChartTypeCombo.SelectedIndex = 0;

            AggregationComboBox.Items.Add("None");
            AggregationComboBox.Items.Add("Stacked");
            AggregationComboBox.Items.Add("Clustered");
            AggregationComboBox.SelectedIndex = 1;

            AnimationThemeTypeComboBox.FillFromEnum(typeof(AnimationThemeType));
            AnimationThemeTypeComboBox.SelectedIndex = (int)AnimationThemeType.ScaleAndFade;

            AxesAnimationDurationUpDown.Value       = (decimal)3;
            WallsAnimationDurationUpDown.Value      = (decimal)3;
            SeriesAnimationDurationUpDown.Value     = (decimal)3;
            IndicatorsAnimationDurationUpDown.Value = (decimal)3;

            GenerateNewDataButton_Click(null, null);

            CalculateIndicatorValues();
        }
        public override void Initialize()
        {
            base.Initialize();

            // confgigure chart
            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel header = new NLabel("Legend Horizontal and Vertical Wrapping");

            header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);
            header.TextStyle.FillStyle = new NColorFillStyle(GreyBlue);
            header.DockMode            = PanelDockMode.Top;
            header.Margins             = new NMarginsL(0, 10, 0, 10);
            nChartControl1.Panels.Add(header);

            NDockPanel container = new NDockPanel();

            container.DockMode = PanelDockMode.Fill;
            container.Margins  = new NMarginsL(10, 10, 10, 10);
            container.PositionChildPanelsInContentBounds = true;
            nChartControl1.Panels.Add(container);

            // configure the legend
            m_Legend = new NLegend();
            m_Legend.Data.ExpandMode  = LegendExpandMode.HorzWrap;
            m_Legend.Location         = new NPointL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(0));
            m_Legend.BoundsMode       = BoundsMode.None;
            m_Legend.Size             = new NSizeL(new NLength(20, NRelativeUnit.ParentPercentage), new NLength(100, NRelativeUnit.ParentPercentage));
            m_Legend.UseAutomaticSize = false;
            container.ChildPanels.Add(m_Legend);

            // configure the chart
            m_Chart = new NCartesianChart();
            container.ChildPanels.Add(m_Chart);
            m_Chart.BoundsMode      = BoundsMode.Stretch;
            m_Chart.Margins         = new NMarginsL(0, 0, 10, 0);
            m_Chart.Location        = new NPointL(new NLength(0), new NLength(0));
            m_Chart.Size            = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(100, NRelativeUnit.ParentPercentage));
            m_Chart.DisplayOnLegend = m_Legend;
            m_Chart.Axis(StandardAxis.Depth).Visible = false;
            m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1);
            m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.BrightCameraLight);

            // add interlace stripe
            NLinearScaleConfigurator linearScale = m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;
            NScaleStripStyle         stripStyle  = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.StripStyles.Add(stripStyle);

            // add the first bar
            m_Bar1                        = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);
            m_Bar1.Name                   = "Bar1";
            m_Bar1.MultiBarMode           = MultiBarMode.Series;
            m_Bar1.Legend.Mode            = SeriesLegendMode.DataPoints;
            m_Bar1.DataLabelStyle.Visible = false;

            // add the second bar
            m_Bar2                        = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);
            m_Bar2.Name                   = "Bar2";
            m_Bar2.MultiBarMode           = MultiBarMode.Stacked;
            m_Bar2.Legend.Mode            = SeriesLegendMode.DataPoints;
            m_Bar2.DataLabelStyle.Visible = false;

            // add the third bar
            m_Bar3                        = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);
            m_Bar3.Name                   = "Bar3";
            m_Bar3.Legend.Mode            = SeriesLegendMode.DataPoints;
            m_Bar3.DataLabelStyle.Visible = false;

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

            styleSheet.Apply(nChartControl1.Document);

            string[] names = Enum.GetNames(typeof(ContentAlignment));
            for (int i = 0; i < names.Length; i++)
            {
                FitAlignmentComboBox.Items.Add(names[i]);
            }

            FitAlignmentComboBox.SelectedItem      = ContentAlignment.TopCenter.ToString();
            LegendWidthNumericUpDown.Value         = 30;
            DataPointsPerSeriesNumericUpDown.Value = 10;
            HorzWrapRadioButton.Checked            = true;

            DataPointsPerSeriesNumericUpDown_ValueChanged(null, null);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                WebExamplesUtilities.FillComboWithValues(LABeginValueDropDownList, 0, 100, 10);
                WebExamplesUtilities.FillComboWithValues(LAEndValueDropDownList, 0, 100, 10);
                WebExamplesUtilities.FillComboWithValues(BABeginValueDropDownList, 0, 100, 10);
                WebExamplesUtilities.FillComboWithValues(BAEndValueDropDownList, 0, 100, 10);

                // init form controls
                LABeginValueDropDownList.SelectedIndex = 2;
                LAEndValueDropDownList.SelectedIndex   = 6;

                BABeginValueDropDownList.SelectedIndex = 2;
                BAEndValueDropDownList.SelectedIndex   = 6;

                // init the form controls
                WebExamplesUtilities.FillComboWithEnumNames(LAContentAlignmentDropDownList, typeof(ContentAlignment));
                LAContentAlignmentDropDownList.SelectedIndex = 0;
                LATextTextBox.Text = "Left Axis Line Text";

                WebExamplesUtilities.FillComboWithEnumNames(BAContentAlignmentDropDownList, typeof(ContentAlignment));
                BAContentAlignmentDropDownList.SelectedIndex = 0;
                BATextTextBox.Text = "Bottom Axis Line Text";
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Axis Stripe Labels");

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

            NChart chart = nChartControl1.Charts[0];

            // disable the depth axis
            chart.Axis(StandardAxis.Depth).Visible = false;

            NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;

            // add interlace stripe
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.StripStyles.Add(stripStyle);

            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator();

            // Add stripes for the left and the bottom axes
            NAxisStripe stripeY = chart.Axis(StandardAxis.PrimaryY).Stripes.Add(2, 3);
            NAxisStripe stripeX = chart.Axis(StandardAxis.PrimaryX).Stripes.Add(2, 3);

            stripeY.FillStyle = new NColorFillStyle(Color.FromArgb(50, Color.Blue));
            stripeY.From      = LABeginValueDropDownList.SelectedIndex * 10;
            stripeY.To        = LAEndValueDropDownList.SelectedIndex * 10;
            stripeY.SetShowAtWall(ChartWallType.Back, true);
            stripeY.TextAlignment = (ContentAlignment)Enum.Parse(typeof(ContentAlignment), LAContentAlignmentDropDownList.SelectedItem.Text);
            stripeY.Text          = LATextTextBox.Text;

            stripeX.FillStyle = new NColorFillStyle(Color.FromArgb(50, Color.Blue));
            stripeX.From      = BABeginValueDropDownList.SelectedIndex * 10;
            stripeX.To        = BAEndValueDropDownList.SelectedIndex * 10;
            stripeX.SetShowAtWall(ChartWallType.Back, true);
            stripeX.TextAlignment = (ContentAlignment)Enum.Parse(typeof(ContentAlignment), BAContentAlignmentDropDownList.SelectedItem.Text);
            stripeX.Text          = BATextTextBox.Text;

            // Create a point series
            NPointSeries pnt = (NPointSeries)chart.Series.Add(SeriesType.Point);

            pnt.InflateMargins         = true;
            pnt.UseXValues             = true;
            pnt.Name                   = "Series 1";
            pnt.DataLabelStyle.Visible = false;

            // Add some data
            pnt.Values.Add(31);
            pnt.Values.Add(67);
            pnt.Values.Add(12);
            pnt.Values.Add(84);
            pnt.Values.Add(90);
            pnt.XValues.Add(10);
            pnt.XValues.Add(36);
            pnt.XValues.Add(52);
            pnt.XValues.Add(62);
            pnt.XValues.Add(88);

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

            styleSheet.Apply(nChartControl1.Document);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
Beispiel #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Axis View Range");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            title.Margins  = new NMarginsL(10, 10, 10, 10);
            title.DockMode = PanelDockMode.Top;

            // turn off the legend
            nChartControl1.Legends[0].Mode = LegendMode.Disabled;

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

            chart.Enable3D = true;
            chart.DockMode = PanelDockMode.Fill;
            chart.Margins  = new NMarginsL(10, 0, 10, 10);

            // apply predefined lighting and projection
            chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);

            // add interlace stripe
            NLinearScaleConfigurator linearScale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;
            NScaleStripStyle         stripStyle  = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.StripStyles.Add(stripStyle);

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

            bar.Name = "Bar Series";
            bar.BorderStyle.Width      = new NLength(0, NGraphicsUnit.Pixel);
            bar.ShadowStyle.Type       = ShadowType.GaussianBlur;
            bar.ShadowStyle.Offset     = new NPointL(2, 2);
            bar.ShadowStyle.Color      = Color.FromArgb(80, 0, 0, 0);
            bar.ShadowStyle.FadeLength = new NLength(5);
            bar.HasBottomEdge          = false;

            // add some data to the bar series
            bar.AddDataPoint(new NDataPoint(18, "Silverlight"));
            bar.AddDataPoint(new NDataPoint(15, "Ajax"));
            bar.AddDataPoint(new NDataPoint(21, "JackBe"));
            bar.AddDataPoint(new NDataPoint(23, "Laszlo"));
            bar.AddDataPoint(new NDataPoint(28, "Java FX"));
            bar.AddDataPoint(new NDataPoint(29, "Flex"));

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

            styleSheet.Apply(nChartControl1.Document.Charts[0]);

            if (CustomViewRangeCheckBox.Checked)
            {
                // specify custom view range
                chart.Axis(StandardAxis.PrimaryY).View = new NRangeAxisView(new NRange1DD(14, 30), true, true);
            }
            else
            {
                chart.Axis(StandardAxis.PrimaryY).View = new NContentAxisView();
            }
        }
Beispiel #13
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            NChart chart = nChartControl1.Charts[0];

            nChartControl1.Controller.Selection.Add(chart);
            nChartControl1.Controller.Tools.Add(new NTrackballTool());

            // set a chart title
            NLabel title = new NLabel("XY Smooth Line");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);

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

            // configure the chart
            chart.Enable3D = true;
            chart.Width    = 70;
            chart.Height   = 70;
            chart.Depth    = 15;
            chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);

            // configure axes
            chart.Axis(StandardAxis.Depth).Visible = false;

            NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator();

            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;

            linearScale = new NLinearScaleConfigurator();
            chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;

            // add interlaced stripe
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.StripStyles.Add(stripStyle);

            // add the line
            NSmoothLineSeries line = (NSmoothLineSeries)chart.Series.Add(SeriesType.SmoothLine);

            line.Name                           = "Smooth Line";
            line.InflateMargins                 = true;
            line.Legend.Mode                    = SeriesLegendMode.Series;
            line.DataLabelStyle.Visible         = false;
            line.MarkerStyle.Visible            = true;
            line.MarkerStyle.PointShape         = PointShape.Cylinder;
            line.MarkerStyle.AutoDepth          = false;
            line.MarkerStyle.Width              = new NLength(1.4f, NRelativeUnit.ParentPercentage);
            line.MarkerStyle.Height             = new NLength(1.4f, NRelativeUnit.ParentPercentage);
            line.MarkerStyle.Depth              = new NLength(1.4f, NRelativeUnit.ParentPercentage);
            line.UseXValues                     = true;
            line.UseZValues                     = false;
            line.Use1DInterpolationForXYScatter = false;

            ChangeData();

            // apply layout
            ConfigureStandardLayout(chart, title, null);

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

            styleSheet.Apply(nChartControl1.Document);
        }
Beispiel #14
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Custom Series");

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

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

            // setup chart
            NChart chart = nChartControl1.Charts[0];

            chart.BoundsMode = BoundsMode.Stretch;

            // setup Y axis
            NAxis axisY = chart.Axis(StandardAxis.PrimaryY);
            NLinearScaleConfigurator linearScaleConfigurator = (NLinearScaleConfigurator)axisY.ScaleConfigurator;

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

            // add interlaced stripe
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScaleConfigurator.StripStyles.Add(stripStyle);

            // configure X axis
            NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator();

            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale;

            // add a custom series and set its callback object
            NCustomSeries customSeries = new NCustomSeries();

            chart.Series.Add(customSeries);

            // create a paint callback object for the custom series
            MyCustomBezierSeries callback = new MyCustomBezierSeries(chart, customSeries);

            customSeries.Callback = callback;
            callback.Points       = new NPointF[]
            {
                new NPointF(10, 20),
                new NPointF(55, 60),
                new NPointF(65, 180),
                new NPointF(110, 102),

                new NPointF(150, 99),
                new NPointF(225, 180),
                new NPointF(190, 202),

                new NPointF(160, 221),
                new NPointF(230, 45),
                new NPointF(200, 21),
            };


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

            styleSheet.Apply(nChartControl1.Document);
        }
Beispiel #15
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = new NLabel("Real Time Stock");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);
            nChartControl1.Panels.Add(title);

            m_Chart            = (NCartesianChart)nChartControl1.Charts[0];
            m_Chart.BoundsMode = BoundsMode.Stretch;

            // add interlace stripes
            NLinearScaleConfigurator linearScale = m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;
            NScaleStripStyle         stripStyle  = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced  = true;
            stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
            linearScale.StripStyles.Add(stripStyle);

            m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NRangeTimelineScaleConfigurator();

            // enable range selection
            NRangeSelection rangeSelection = new NRangeSelection();

            rangeSelection.VerticalValueSnapper = new NAxisRulerMinMaxSnapper();
            m_Chart.RangeSelections.Add(rangeSelection);

            // enable zooming and scrolling
            m_Chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true;
            m_Chart.Axis(StandardAxis.PrimaryX).PagingView        = new NDateTimeAxisPagingView();

            m_LineSMA = new NLineSeries();

            // create a line series for the simple moving average
            m_Chart.Series.Add(m_LineSMA);

            m_LineSMA.Name = "SMA(20)";
            m_LineSMA.DataLabelStyle.Visible = false;
            m_LineSMA.BorderStyle.Color      = Color.DarkOrange;
            m_LineSMA.UseXValues             = true;

            // create the stock series
            m_Stock = new NStockSeries();
            m_Chart.Series.Add(m_Stock);
            m_Stock.DisplayOnAxis(StandardAxis.PrimaryX, true);

            m_Stock.Name                   = "Stock Data";
            m_Stock.Legend.Mode            = SeriesLegendMode.None;
            m_Stock.DataLabelStyle.Visible = false;
            m_Stock.CandleStyle            = CandleStyle.Bar;
            m_Stock.CandleWidth            = new NLength(0.8f, NRelativeUnit.ParentPercentage);
            m_Stock.InflateMargins         = true;
            m_Stock.UseXValues             = true;
            m_Stock.UpFillStyle            = new NColorFillStyle(LightGreen);
            m_Stock.UpStrokeStyle.Color    = Color.Black;
            m_Stock.DownFillStyle          = new NColorFillStyle(Red);
            m_Stock.DownStrokeStyle.Color  = Color.Black;
            m_Stock.OpenValues.Name        = "open";
            m_Stock.CloseValues.Name       = "close";
            m_Stock.HighValues.Name        = "high";
            m_Stock.LowValues.Name         = "low";

            nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
            nChartControl1.Controller.Tools.Add(new NAxisScrollTool());
            nChartControl1.Controller.Tools.Add(new NDataZoomTool());
            nChartControl1.Controller.Tools.Add(new NDataPanTool());

            // apply layout
            ConfigureStandardLayout(m_Chart, title, null);

            NumberOfDataPointsComboBox.Items.Add("1000");
            NumberOfDataPointsComboBox.Items.Add("5000");
            NumberOfDataPointsComboBox.Items.Add("10000");
            NumberOfDataPointsComboBox.SelectedIndex = 1;

            AddData();

            UseHardwareAccelerationCheckBox.IsChecked = true;
            nChartControl1.Settings.RenderSurface     = RenderSurface.Window;
            StartTimer();
        }
        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("Wireframe Surface");

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

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

            // setup chart
            NChart chart = nChartControl1.Charts[0];

            chart.Enable3D             = true;
            chart.Width                = 70.0f;
            chart.Depth                = 70.0f;
            chart.Height               = 30.0f;
            chart.Projection.Type      = ProjectionType.Perspective;
            chart.Projection.Elevation = 28;
            chart.Projection.Rotation  = -18;
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft);

            if (!IsPostBack)
            {
                RotationTextBox.Text  = chart.Projection.Rotation.ToString();
                ElevationTextBox.Text = chart.Projection.Elevation.ToString();

                WebExamplesUtilities.FillComboWithColorNames(LineColorDropDownList, KnownColor.Black);
                WebExamplesUtilities.FillComboWithValues(LineWidhtDropDownList, 1, 5, 1);
            }
            else
            {
                chart.Projection.Rotation  = (float)Convert.ToDouble(RotationTextBox.Text);
                chart.Projection.Elevation = (float)Convert.ToDouble(ElevationTextBox.Text);
            }

            // setup Y axis
            NLinearScaleConfigurator linearScaleConfigurator = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;

            linearScaleConfigurator.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 8);

            // add interlace stripe
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScaleConfigurator.StripStyles.Add(stripStyle);

            // setup X axis
            NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator();

            scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Back };
            scaleX.RoundToTickMin             = false;
            scaleX.RoundToTickMax             = false;
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX;

            // setup Z axis
            NLinearScaleConfigurator scaleZ = new NLinearScaleConfigurator();

            scaleZ.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Left };
            scaleZ.RoundToTickMin             = false;
            scaleZ.RoundToTickMax             = false;
            chart.Axis(StandardAxis.Depth).ScaleConfigurator = scaleZ;

            // add the surface series
            NGridSurfaceSeries surface = (NGridSurfaceSeries)chart.Series.Add(SeriesType.GridSurface);

            surface.Name      = "Surface";
            surface.FillMode  = SurfaceFillMode.None;
            surface.FrameMode = SurfaceFrameMode.Mesh;
            surface.Data.SetGridSize(30, 30);
            surface.SyncPaletteWithAxisScale       = false;
            surface.PaletteSteps                   = 8;
            surface.ValueFormatter.FormatSpecifier = "0.0";
            surface.Legend.Mode = SeriesLegendMode.None;

            if (PaletteFrameCheckBox.Checked)
            {
                surface.FrameColorMode = SurfaceFrameColorMode.Zone;
            }
            else
            {
                surface.FrameColorMode = SurfaceFrameColorMode.Uniform;
            }

            SmoothPaletteCheckBox.Enabled = PaletteFrameCheckBox.Checked;

            if (SmoothPaletteCheckBox.Checked)
            {
                surface.SmoothPalette = true;
                surface.Legend.Format = "<zone_value>";
            }
            else
            {
                surface.SmoothPalette = false;
                surface.Legend.Format = "<zone_begin> - <zone_end>";
            }

            surface.FrameStrokeStyle.Color = WebExamplesUtilities.ColorFromDropDownList(LineColorDropDownList);
            surface.FrameStrokeStyle.Width = new NLength(LineWidhtDropDownList.SelectedIndex + 1, NGraphicsUnit.Pixel);

            FillData(surface);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("XY Error Bar");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);
            title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue);

            // remove the legend
            nChartControl1.Legends.Clear();

            m_Chart = nChartControl1.Charts[0];

            // setup axes
            NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator();

            linearScale.MajorGridStyle.ShowAtWalls                = new ChartWallType[] { ChartWallType.Back, ChartWallType.Floor };
            linearScale.MajorGridStyle.LineStyle.Pattern          = LinePattern.Dot;
            m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale;

            linearScale = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;
            linearScale.MajorGridStyle.ShowAtWalls       = new ChartWallType[] { ChartWallType.Back, ChartWallType.Left };
            linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;

            // add interlace stripe
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.StripStyles.Add(stripStyle);

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

            // add an error bar series
            NErrorBarSeries series = (NErrorBarSeries)m_Chart.Series.Add(SeriesType.ErrorBar);

            series.DataLabelStyle.Visible  = false;
            series.BorderStyle             = new NStrokeStyle(GreyBlue);
            series.MarkerStyle.Visible     = true;
            series.MarkerStyle.PointShape  = PointShape.Ellipse;
            series.MarkerStyle.AutoDepth   = false;
            series.MarkerStyle.FillStyle   = new NColorFillStyle(DarkOrange);
            series.MarkerStyle.BorderStyle = new NStrokeStyle(GreyBlue);
            series.MarkerStyle.Width       = new NLength(1.2f, NRelativeUnit.ParentPercentage);
            series.MarkerStyle.Height      = new NLength(1.2f, NRelativeUnit.ParentPercentage);
            series.MarkerStyle.Depth       = new NLength(1.2f, NRelativeUnit.ParentPercentage);
            series.ShowLowerErrorX         = true;
            series.ShowUpperErrorX         = true;
            series.UseXValues = true;

            GenerateData(series);

            // apply layout
            ConfigureStandardLayout(m_Chart, title, null);

            // init form controls
            YErrorWhiskerSizeScrollBar.Value  = series.SizeY.Value / 5.0f;
            ShowLowerYErrorCheckBox.IsChecked = series.ShowLowerErrorY;
            ShowUpperYErrorCheckBox.IsChecked = series.ShowUpperErrorY;

            XErrorWhiskerSizeScrollBar.Value  = series.SizeX.Value / 5.0f;
            ShowLowerXErrorCheckBox.IsChecked = series.ShowLowerErrorX;
            ShowUpperXErrorCheckBox.IsChecked = series.ShowUpperErrorX;


            LeftAxisRoundToTickCheckBox.IsChecked = true;
            InflateMarginsCheckBox.IsChecked      = true;
        }
        public override void Initialize()
        {
            base.Initialize();

            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel header = new NLabel("Company Sales by Region<br/><font size = '9pt'>Demonstrates how to use custom range labels to denote ranges on a scale</font>");

            header.DockMode             = PanelDockMode.Top;
            header.Margins              = new NMarginsL(0, 10, 0, 10);
            header.TextStyle.FontStyle  = new NFontStyle("Times New Roman", 18, FontStyle.Italic);
            header.TextStyle.TextFormat = TextFormat.XML;
            header.ContentAlignment     = ContentAlignment.BottomRight;
            header.Location             = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));
            nChartControl1.Panels.Add(header);

            NLegend legend = new NLegend();

            legend.Margins      = new NMarginsL(10, 0, 10, 0);
            legend.DockMode     = PanelDockMode.Right;
            legend.FitAlignment = ContentAlignment.TopCenter;
            nChartControl1.Panels.Add(legend);

            NCartesianChart chart = new NCartesianChart();

            nChartControl1.Panels.Add(chart);

            chart.DisplayOnLegend = legend;
            chart.DockMode        = PanelDockMode.Fill;
            chart.BoundsMode      = BoundsMode.Stretch;
            chart.Margins         = new NMarginsL(10, 0, 0, 10);
            chart.Axis(StandardAxis.Depth).Visible = false;

            // add range selection
            NRangeSelection rangeSelection = new NRangeSelection();

            rangeSelection.VerticalValueSnapper = new NAxisRulerMinMaxSnapper();
            chart.RangeSelections.Add(rangeSelection);

            // add the first bar
            m_Bar1                       = (NBarSeries)chart.Series.Add(SeriesType.Bar);
            m_Bar1.Name                  = "Coca Cola";
            m_Bar1.MultiBarMode          = MultiBarMode.Series;
            m_Bar1.DataLabelStyle.Format = "<value>";

            // add the second bar
            m_Bar2                       = (NBarSeries)chart.Series.Add(SeriesType.Bar);
            m_Bar2.Name                  = "Pepsi";
            m_Bar2.MultiBarMode          = MultiBarMode.Clustered;
            m_Bar2.DataLabelStyle.Format = "<value>";

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

            styleSheet.Apply(nChartControl1.Document);

            // add custom labels to the X axis
            NAxis xAxis = chart.Axis(StandardAxis.PrimaryX);

            xAxis.ScrollBar.Visible = true;
            NOrdinalScaleConfigurator ordinalScale = xAxis.ScaleConfigurator as NOrdinalScaleConfigurator;

            ordinalScale.AutoLabels = false;
            ordinalScale.OuterMajorTickStyle.Visible = false;
            ordinalScale.InnerMajorTickStyle.Visible = false;

            // add custom labels to the Y axis
            chart.Axis(StandardAxis.PrimaryY).View = new NRangeAxisView(new NRange1DD(0, 320));
            NLinearScaleConfigurator linearScale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;

            linearScale.RoundToTickMax = false;
            NCustomRangeLabel rangeLabel = new NCustomRangeLabel(new NRange1DD(240, 320), "Target Volume");

            rangeLabel.Style.TickMode = RangeLabelTickMode.Center;
            rangeLabel.Style.WrapText = true;
            rangeLabel.Style.Angle    = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0);
            linearScale.CustomLabels.Add(rangeLabel);

            // add interlace stripe
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.StripStyles.Add(stripStyle);

            // configure interactivity
            nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
            nChartControl1.Controller.Tools.Add(new NAxisScrollTool());
            nChartControl1.Controller.Tools.Add(new NDataZoomTool());

            // init form controls
            LabelTickModeComboBox.FillFromEnum(typeof(RangeLabelTickMode));
            LabelVisibilityModeComboBox.FillFromEnum(typeof(ScaleLabelVisibilityMode));
            LabelFitModeComboBox.FillFromEnum(typeof(RangeLabelFitMode));

            NRangeScaleLabelStyle defaultStyle = new NRangeScaleLabelStyle();

            LabelTickModeComboBox.SelectedIndex       = (int)defaultStyle.TickMode;
            LabelVisibilityModeComboBox.SelectedIndex = (int)defaultStyle.VisibilityMode;
            LabelFitModeComboBox.SelectedIndex        = (int)defaultStyle.FitMode;
            LabelAngleNumericUpDown.Value             = (decimal)defaultStyle.Angle.CustomAngle;
            TickPaddingNumericUpDown.Value            = (decimal)defaultStyle.TickPadding.Value;
            TickOffsetNumericUpDown.Value             = (decimal)defaultStyle.TickOffset.Value;
            TextOffsetNumericUpDown.Value             = (decimal)defaultStyle.Offset.Value;
            TextPaddingNumericUpDown.Value            = (decimal)defaultStyle.TextPadding.Value;

            // add some data
            NorthAmericaCheckBox.Checked = true;
            EuropeCheckBox.Checked       = true;
            AsiaCheckBox.Checked         = true;
            SouthAmericaCheckBox.Checked = true;
        }
        public override void Initialize()
        {
            base.Initialize();

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("XY Smooth Area");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);

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

            // setup chart
            m_Chart          = nChartControl1.Charts[0];
            m_Chart.Enable3D = true;
            m_Chart.Width    = 65;
            m_Chart.Height   = 40;
            m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective);
            m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
            m_Chart.Axis(StandardAxis.Depth).Visible = false;

            // setup axes
            NLinearScaleConfigurator linearScaleX = new NLinearScaleConfigurator();

            m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScaleX;

            NLinearScaleConfigurator linearScaleY = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;

            linearScaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScaleY.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);

            // add interlaced stripe
            NLinearScaleConfigurator linearScale = m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;
            NScaleStripStyle         stripStyle  = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScaleY.StripStyles.Add(stripStyle);

            // add the area series
            m_SmoothArea = new NSmoothAreaSeries();
            m_Chart.Series.Add(m_SmoothArea);

            m_SmoothArea.DataLabelStyle.Visible = false;
            m_SmoothArea.MarkerStyle.Visible    = false;
            m_SmoothArea.UseXValues             = true;

            NPalette palette = new NPalette();

            palette.Clear();
            palette.Mode = PaletteMode.Custom;
            palette.Add(0, Color.Green);
            palette.Add(5, Color.Yellow);
            palette.Add(10, Color.Red);

            m_SmoothArea.Palette = palette;

            GenerateYValues(nValuesCount);
            GenerateXValues(nValuesCount);

            // apply layout
            ConfigureStandardLayout(m_Chart, title, null);

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

            styleSheet.Apply(nChartControl1.Document);
            SmoothPaletteCheckBox.Checked = true;
            Enable3DCheckBox.Checked      = true;
        }
Beispiel #20
0
        public override void Initialize()
        {
            base.Initialize();

            // set a chart title
            NLabel title = new NLabel("Gantt Chart");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);

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

            // configure the chart
            NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];

            chart.BoundsMode = BoundsMode.Stretch;
            chart.SetPredefinedChartStyle(PredefinedChartStyle.HorizontalLeft);
            chart.Axis(StandardAxis.Depth).Visible = false;

            // setup the value axis
            NRangeTimelineScaleConfigurator dateTimeScale = new NRangeTimelineScaleConfigurator();

            dateTimeScale.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };

            // add interlaced stripe
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
            stripStyle.Interlaced  = true;
            dateTimeScale.StripStyles.Add(stripStyle);

            chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = dateTimeScale;
            chart.Axis(StandardAxis.PrimaryY).Anchor            = new NDockAxisAnchor(AxisDockZone.FrontRight, true, 0, 100);

            // fill data
            DateTime start = DateTime.Now;
            DateTime end   = start + new TimeSpan(10, 0, 0, 0);

            TaskCollection tasks = new TaskCollection();

            tasks.Add(new Task("Write Proposal",
                               new DateTime(2001, 4, 1),
                               new DateTime(2001, 4, 5),
                               new uint[] { 1, 2 }));

            tasks.Add(new Task("Obtain Approval",
                               new DateTime(2001, 4, 12),
                               new DateTime(2001, 9, 4),
                               new uint[] { 9 }));

            tasks.Add(new Task("Requirements Analysis",
                               new DateTime(2001, 4, 9),
                               new DateTime(2001, 5, 5),
                               new uint[] { 3 }));

            tasks.Add(new Task("Design Phase",
                               new DateTime(2001, 5, 6),
                               new DateTime(2001, 5, 30),
                               new uint[] { 4 }));

            tasks.Add(new Task("Design Signoff",
                               new DateTime(2001, 6, 2),
                               new DateTime(2001, 6, 2),
                               new uint[] { 5 }));

            tasks.Add(new Task("Alpha Implementation",
                               new DateTime(2001, 6, 3),
                               new DateTime(2001, 7, 31),
                               new uint[] { 6 }));

            tasks.Add(new Task("Design Review",
                               new DateTime(2001, 8, 1),
                               new DateTime(2001, 8, 8),
                               new uint[] { 7 }));

            tasks.Add(new Task("Revised Design Signoff",
                               new DateTime(2001, 8, 10),
                               new DateTime(2001, 8, 10),
                               new uint[] { 8 }));

            tasks.Add(new Task("Beta Implementation",
                               new DateTime(2001, 8, 12),
                               new DateTime(2001, 9, 12),
                               new uint[] { 9 }));

            tasks.Add(new Task("Testing",
                               new DateTime(2001, 9, 13),
                               new DateTime(2001, 10, 31),
                               new uint[] { 10 }));

            tasks.Add(new Task("Final Implementation",
                               new DateTime(2001, 11, 1),
                               new DateTime(2001, 11, 15),
                               new uint[] { 11 }));

            tasks.Add(new Task("Signoff",
                               new DateTime(2001, 11, 28),
                               new DateTime(2001, 11, 30),
                               new uint[] { 12 }));

            tasks.ConfigureChart(chart);

            // apply layout
            ConfigureStandardLayout(chart, title, null);

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

            styleSheet.Apply(nChartControl1.Document);

            nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
            nChartControl1.Controller.Tools.Add(new NFloatBarDragPointTool());

            // init form controls
            ShowGanttConnectorLinesCheckBox.Checked = true;
        }
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader(this.Title);

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

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

            // do not update automatic legends
            nChartControl1.ServiceManager.LegendUpdateService.UpdateAutoLegends();
            nChartControl1.ServiceManager.LegendUpdateService.Stop();

            // configure the chart
            NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];

            chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted);
            chart.BoundsMode       = BoundsMode.Fit;
            chart.Enable3D         = true;
            chart.Fit3DAxisContent = false;

            // make the aspect 6:1:2
            chart.Width  = 60;
            chart.Height = 20;
            chart.Depth  = 20;

            // configure the y axis
            NAxis yAxis = chart.Axis(StandardAxis.PrimaryY);

            yAxis.View = new NRangeAxisView(new NRange1DD(0, m_MaxValue));

            NLinearScaleConfigurator linearScale = yAxis.ScaleConfigurator as NLinearScaleConfigurator;

            // add interlace stripe
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.StripStyles.Add(stripStyle);

            linearScale.MajorGridStyle.LineStyle.Color = Color.LightSteelBlue;
            linearScale.InnerMinorTickStyle.Visible    = false;
            linearScale.InnerMajorTickStyle.Visible    = false;
            linearScale.LabelFitModes = new LabelFitMode[0];

            // configure the x axis
            NAxis xAxis = chart.Axis(StandardAxis.PrimaryX);

            linearScale = new NLinearScaleConfigurator();
            linearScale.LabelFitModes  = new LabelFitMode[0];
            xAxis.ScaleConfigurator    = linearScale;
            linearScale.RoundToTickMax = false;
            linearScale.RoundToTickMin = false;
            linearScale.InnerMinorTickStyle.Visible = false;
            linearScale.InnerMajorTickStyle.Visible = false;

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

            // apply layout
            ConfigureStandardLayout(chart, title, null);

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

            styleSheet.Apply(nChartControl1.Document);

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

            GridSizeXComboBox.Items.Add("10");
            GridSizeXComboBox.Items.Add("50");
            GridSizeXComboBox.Items.Add("100");

            GridSizeYComboBox.Items.Add("10");
            GridSizeYComboBox.Items.Add("50");
            GridSizeYComboBox.Items.Add("100");

            GridSizeXComboBox.SelectedIndex = 2;
            GridSizeYComboBox.SelectedIndex = 2;

            UseHardwareAccelerationCheckBox.IsChecked = true;
            nChartControl1.Settings.RenderSurface     = RenderSurface.Window;
            StartTimer();

            ConfigureStandardLayout(chart, title, null);
        }
Beispiel #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DefaultFormatDropDown.Items.Add("[value] [label]");
                DefaultFormatDropDown.Items.Add("[index] [cumulative]");
                DefaultFormatDropDown.Items.Add("[percent] [total]");
                DefaultFormatDropDown.SelectedIndex = 0;

                DefaultVerticalAlignDropDown.Items.Add("Center");
                DefaultVerticalAlignDropDown.Items.Add("Top");
                DefaultVerticalAlignDropDown.Items.Add("Bottom");
                DefaultVerticalAlignDropDown.SelectedIndex = 1;

                DefaultLabelVisibleCheck.Checked     = true;
                DefaultBackplaneVisibleCheck.Checked = true;

                Label3FormatDropDown.Items.Add("Individual");
                Label3FormatDropDown.Items.Add("[value] [label]");
                Label3FormatDropDown.Items.Add("[index] [cumulative]");
                Label3FormatDropDown.Items.Add("[percent] [total]");
                Label3FormatDropDown.SelectedIndex = 0;

                Label3VerticalAlignDropDown.Items.Add("Center");
                Label3VerticalAlignDropDown.Items.Add("Top");
                Label3VerticalAlignDropDown.Items.Add("Bottom");
                Label3VerticalAlignDropDown.SelectedIndex = 1;

                Label3VisibleCheck.Checked     = true;
                Backplane3VisibleCheck.Checked = true;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
            nChartControl1.Legends[0].Visible = false;

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

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

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

            // setup chart
            NChart chart = nChartControl1.Charts[0];

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

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

            bar.AddDataPoint(new NDataPoint(10, "Item A"));
            bar.AddDataPoint(new NDataPoint(20, "Item B"));
            bar.AddDataPoint(new NDataPoint(30, "Item C"));
            bar.AddDataPoint(new NDataPoint(25, "Item D"));
            bar.AddDataPoint(new NDataPoint(29, "Item E"));

            // add interlaced stripe
            NLinearScaleConfigurator linearScaleConfigurator = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;
            NScaleStripStyle         stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScaleConfigurator.StripStyles.Add(stripStyle);

            // apply style sheet
            NFillStyleSheetConfigurator fillStyleSheet = new NFillStyleSheetConfigurator();

            fillStyleSheet.SeriesFillTemplate = new NGradientFillStyleTemplate(GradientStyle.Horizontal, GradientVariant.Variant1);
            fillStyleSheet.MultiColorSeries   = true;
            fillStyleSheet.Palette.SetPredefinedPalette(ChartPredefinedPalette.Nature);
            NStrokeStyleSheetConfigurator strokeStyleSheet = new NStrokeStyleSheetConfigurator();

            strokeStyleSheet.MultiColorSeries  = true;
            strokeStyleSheet.ApplyToDataLabels = false;
            strokeStyleSheet.Palette.SetPredefinedPalette(ChartPredefinedPalette.Nature);

            NStyleSheet styleSheet = new NStyleSheet();

            fillStyleSheet.ConfigureSheet(styleSheet);
            strokeStyleSheet.ConfigureSheet(styleSheet);
            styleSheet.Apply(bar);

            // add a different data label for data point 3
            NDataLabelStyle label = new NDataLabelStyle();

            label.TextStyle.FontStyle.Style          = FontStyle.Bold;
            label.TextStyle.FillStyle                = new NColorFillStyle(Color.Crimson);
            label.TextStyle.BackplaneStyle.Inflate   = new NSizeL(3, 3);
            label.TextStyle.BackplaneStyle.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant2, Color.White, Color.Lavender);
            bar.DataLabelStyles[3] = label;

            label.Format    = WebExamplesUtilities.GetXmlFormatString(Label3FormatDropDown.SelectedItem.Text);
            label.VertAlign = (VertAlign)Label3VerticalAlignDropDown.SelectedIndex;
            label.Visible   = Label3VisibleCheck.Checked;
            label.TextStyle.BackplaneStyle.Visible = Backplane3VisibleCheck.Checked;

            bar.DataLabelStyle.Format    = WebExamplesUtilities.GetXmlFormatString(DefaultFormatDropDown.SelectedItem.Text);
            bar.DataLabelStyle.VertAlign = (VertAlign)DefaultVerticalAlignDropDown.SelectedIndex;
            bar.DataLabelStyle.Visible   = DefaultLabelVisibleCheck.Checked;
            bar.DataLabelStyle.TextStyle.BackplaneStyle.Visible = DefaultBackplaneVisibleCheck.Checked;

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
Beispiel #23
0
        public override void Initialize()
        {
            base.Initialize();

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

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Cluster Stack Bar Chart");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);

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

            // configure Y axis
            NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator();

            scaleY.MajorGridStyle.LineStyle.Pattern             = LinePattern.Dot;
            scaleY.MajorGridStyle.ShowAtWalls                   = new ChartWallType[] { ChartWallType.Back };
            chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY;

            // add interlaced stripe for Y axis
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced  = true;
            stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
            scaleY.StripStyles.Add(stripStyle);

            NSizeL dataPointSafeguardSize = new NSizeL(
                new NLength(1.3f, NRelativeUnit.ParentPercentage),
                new NLength(1.3f, NRelativeUnit.ParentPercentage));

            // series 1
            NBarSeries series1 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            series1.Name      = "Bar 1";
            series1.FillStyle = new NColorFillStyle(DarkOrange);
            series1.DataLabelStyle.Visible   = true;
            series1.DataLabelStyle.VertAlign = VertAlign.Center;

            // series 2
            NBarSeries series2 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            series2.Name                     = "Bar 2";
            series2.MultiBarMode             = MultiBarMode.Stacked;
            series2.FillStyle                = new NColorFillStyle(LightOrange);
            series2.DataLabelStyle.Visible   = true;
            series2.DataLabelStyle.VertAlign = VertAlign.Center;

            // series 3
            NBarSeries series3 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            series3.Name                       = "Bar 3";
            series3.MultiBarMode               = MultiBarMode.Clustered;
            series3.FillStyle                  = new NColorFillStyle(LightGreen);
            series3.DataLabelStyle.Visible     = true;
            series3.DataLabelStyle.VertAlign   = VertAlign.Top;
            series3.DataLabelStyle.ArrowLength = new NLength(10);

            // generate random data
            GenerateData(chart);

            // enable initial labels positioning
            chart.LabelLayout.EnableInitialPositioning = true;

            // enable label adjustment
            chart.LabelLayout.EnableLabelAdjustment = true;

            // series 1 data points must not be overlapped
            series1.LabelLayout.EnableDataPointSafeguard = true;
            series1.LabelLayout.DataPointSafeguardSize   = dataPointSafeguardSize;

            // do not use label location proposals for series 1
            series1.LabelLayout.UseLabelLocations = false;

            // series 2 data points must not be overlapped
            series2.LabelLayout.EnableDataPointSafeguard = true;
            series2.LabelLayout.DataPointSafeguardSize   = dataPointSafeguardSize;

            // do not use label location proposals for series 2
            series2.LabelLayout.UseLabelLocations = false;

            // series 3 data points must not be overlapped
            series3.LabelLayout.EnableDataPointSafeguard = true;
            series3.LabelLayout.DataPointSafeguardSize   = dataPointSafeguardSize;

            // series 3 data labels can be placed above and below the origin point
            series3.LabelLayout.UseLabelLocations        = true;
            series3.LabelLayout.LabelLocations           = new LabelLocation[] { LabelLocation.Top, LabelLocation.Bottom };
            series3.LabelLayout.InvertLocationsIfIgnored = false;
            series3.LabelLayout.OutOfBoundsLocationMode  = OutOfBoundsLocationMode.PushWithinBounds;

            // apply layout
            ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]);

            // init form controls
            EnableInitialPositioningCheck.Checked = true;
            EnableLabelAdjustmentCheck.Checked    = true;
        }
Beispiel #24
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = new NLabel("Cluster Float Bar");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);

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

            chart.Enable3D = true;
            chart.Width    = 65;
            chart.Height   = 40;
            chart.Axis(StandardAxis.Depth).Visible = false;
            chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);

            // add interlaced stripe to the Y axis
            NLinearScaleConfigurator scaleY     = new NLinearScaleConfigurator();
            NScaleStripStyle         stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            stripStyle.Interlaced = true;
            scaleY.StripStyles.Add(stripStyle);

            chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY;

            // setup the bar series
            NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar.Name = "Bar series";
            bar.DataLabelStyle.Visible = false;
            bar.Values.FillRandomRange(Random, 8, 7, 15);

            // setup the floatbar series
            NFloatBarSeries floatbar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar);

            floatbar.MultiFloatBarMode = MultiFloatBarMode.Clustered;
            floatbar.Name = "Floatbar series";
            floatbar.DataLabelStyle.Visible = false;

            floatbar.AddDataPoint(new NFloatBarDataPoint(3.1, 5.2));
            floatbar.AddDataPoint(new NFloatBarDataPoint(4.0, 6.1));
            floatbar.AddDataPoint(new NFloatBarDataPoint(2.0, 6.4));
            floatbar.AddDataPoint(new NFloatBarDataPoint(5.3, 7.3));
            floatbar.AddDataPoint(new NFloatBarDataPoint(3.8, 8.4));
            floatbar.AddDataPoint(new NFloatBarDataPoint(4.0, 7.7));
            floatbar.AddDataPoint(new NFloatBarDataPoint(2.9, 4.1));
            floatbar.AddDataPoint(new NFloatBarDataPoint(5.0, 7.2));

            // apply layout
            ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]);

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

            styleSheet.Apply(nChartControl1.Document);

            nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
            nChartControl1.Controller.Tools.Add(new NTrackballTool());
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
            }

            nChartControl1.Panels.Clear();
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = new NLabel("Flash Interactivity");

            title.TextStyle.FontStyle            = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.DockMode                       = PanelDockMode.Top;
            title.InteractivityStyle.UrlLink.Url = "http://www.apple.com";
            nChartControl1.Panels.Add(title);

            NDockPanel contentPanel = new NDockPanel();

            nChartControl1.Panels.Add(contentPanel);

            contentPanel.DockMode = PanelDockMode.Fill;

            // configure the chart
            NCartesianChart chart = new NCartesianChart();

            contentPanel.ChildPanels.Add(chart);
            chart.Location = new NPointL(0, 0);
            chart.Size     = new NSizeL(new NLength(100, NRelativeUnit.ParentPercentage),
                                        new NLength(60, NRelativeUnit.ParentPercentage));
            chart.Enable3D = false;
            chart.Axis(StandardAxis.Depth).Visible = false;
            chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.BrightCameraLight);
            chart.Margins    = new NMarginsL(5, 5, 5, 5);
            chart.BoundsMode = BoundsMode.Stretch;
            chart.DockMode   = PanelDockMode.Fill;

            // configure axes
            NOrdinalScaleConfigurator ordinalScale = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;

            ordinalScale.AutoLabels = false;
            ordinalScale.Labels.Add("2004");
            ordinalScale.Labels.Add("2005");
            ordinalScale.Labels.Add("2006");
            ordinalScale.Labels.Add("2007");
            ordinalScale.Labels.Add("2008");
            ordinalScale.Labels.Add("2009");

            // add interlace stripe
            NLinearScaleConfigurator linearScale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;

            linearScale.Title.Text      = "Sales in Thousands USD";
            linearScale.MinTickDistance = new NLength(15);
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.StripStyles.Add(stripStyle);

            // create  series
            NBarSeries bar1 = (NBarSeries)chart.Series.Add(SeriesType.Bar);
            NBarSeries bar2 = (NBarSeries)chart.Series.Add(SeriesType.Bar);
            NBarSeries bar3 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar1.MultiBarMode = MultiBarMode.Clustered;
            bar2.MultiBarMode = MultiBarMode.Clustered;
            bar3.MultiBarMode = MultiBarMode.Clustered;

            // configure common settings
            bar1.Name = "Apple";
            bar2.InteractivityStyle.UrlLink.Url = "http://www.apple.com";
            bar1.DataLabelStyle.Visible         = false;

            bar2.Name = "Nokia";
            bar2.InteractivityStyle.UrlLink.Url = "http://www.nokia.com";
            bar2.DataLabelStyle.Visible         = false;

            bar3.Name = "HTC";
            bar3.InteractivityStyle.UrlLink.Url = "http://www.htc.com";
            bar3.DataLabelStyle.Visible         = false;

            // fill with random data
            bar1.Values.FillRandomRange(Random, 6, 10, 100);
            bar2.Values.FillRandomRange(Random, 6, 10, 100);
            bar3.Values.FillRandomRange(Random, 6, 10, 100);

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

            styleSheet.Apply(nChartControl1.Document);

            // apply animation theme
            NAnimationTheme animationTheme = new NAnimationTheme();

            animationTheme.AnimateSeriesSequentially     = true;
            animationTheme.AnimateDataPointsSequentially = false;
            animationTheme.AnimateChartsSequentially     = false;

            animationTheme.WallsAnimationDuration  = 1;
            animationTheme.AxesAnimationDuration   = 1;
            animationTheme.SeriesAnimationDuration = 1;

            animationTheme.AnimationThemeType = AnimationThemeType.ScaleAndFade;
            //	animationTheme.Apply(nChartControl1.Document);

            NImageResponse swfResponse = new NImageResponse();

            swfResponse.ImageFormat = new NSwfImageFormat();

            nChartControl1.ImageAcquisitionMode = ClientSideImageAcquisitionMode.TempFile;
            nChartControl1.ServerSettings.BrowserResponseSettings.DefaultResponse = swfResponse;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataLabelFormatDropDownList.Items.Add("high");
                DataLabelFormatDropDownList.Items.Add("low");
                DataLabelFormatDropDownList.Items.Add("high low");
                DataLabelFormatDropDownList.SelectedIndex = 0;

                WebExamplesUtilities.FillComboWithEnumValues(MarkerShapeDropDownList, typeof(PointShape));
                MarkerShapeDropDownList.SelectedIndex = 0;

                WebExamplesUtilities.FillComboWithColorNames(HighAreaColorDropDownList, KnownColor.LightSlateGray);
                WebExamplesUtilities.FillComboWithColorNames(LowAreaColorDropDownList, KnownColor.DarkOrange);
                WebExamplesUtilities.FillComboWithValues(MarkerSizeDropDownList, 0, 5, 1);
                MarkerSizeDropDownList.SelectedIndex = 2;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("2D High-Low Chart");

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

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

            chart.BoundsMode = BoundsMode.Stretch;

            // setup X axis
            NOrdinalScaleConfigurator scaleX = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator;

            scaleX.DisplayDataPointsBetweenTicks = false;

            // setup Y axis
            NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;

            scaleY.MajorGridStyle.LineStyle.Color = Color.LightGray;

            // add interlace stripe
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced  = true;
            stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
            scaleY.StripStyles.Add(stripStyle);

            NHighLowSeries highLow = (NHighLowSeries)chart.Series.Add(SeriesType.HighLow);

            highLow.Name                  = "High-Low Series";
            highLow.InflateMargins        = true;
            highLow.Legend.Mode           = SeriesLegendMode.SeriesLogic;
            highLow.MarkerStyle.FillStyle = new NColorFillStyle(Red);
            highLow.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(7);
            highLow.LowValues.ValueFormatter  = new NNumericValueFormatter("0.#");
            highLow.HighValues.ValueFormatter = new NNumericValueFormatter("0.#");

            highLow.HighFillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(HighAreaColorDropDownList));
            highLow.LowFillStyle  = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(LowAreaColorDropDownList));

            highLow.DropLines = ShowDropLinesCheckBox.Checked;
            highLow.DataLabelStyle.Visible = ShowDataLabelsCheckBox.Checked;

            switch (DataLabelFormatDropDownList.SelectedIndex)
            {
            case 0:
                highLow.DataLabelStyle.Format = "<high_value>";
                break;

            case 1:
                highLow.DataLabelStyle.Format = "<low_value>";
                break;

            case 2:
                highLow.DataLabelStyle.Format = "<high_value> - <low_value>";
                break;
            }

            MarkerShapeDropDownList.Enabled = ShowMarkersCheckBox.Checked;
            MarkerSizeDropDownList.Enabled  = ShowMarkersCheckBox.Checked;

            highLow.MarkerStyle.Visible    = ShowMarkersCheckBox.Checked;
            highLow.MarkerStyle.PointShape = (PointShape)MarkerShapeDropDownList.SelectedIndex;
            highLow.MarkerStyle.Width      = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage);
            highLow.MarkerStyle.Height     = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage);

            GenerateData(highLow);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]);
        }
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = new NLabel("Gantt");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);

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

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

            chart.BoundsMode = BoundsMode.Stretch;
            chart.Projection.ViewerRotation        = 270;
            chart.Axis(StandardAxis.Depth).Visible = false;

            // setup the value axis
            NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator();

            dateTimeScale.LabelValueFormatter        = new NDateTimeValueFormatter(DateTimeValueFormat.Date);
            dateTimeScale.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };

            // add interlaced stripe
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
            stripStyle.Interlaced  = true;
            dateTimeScale.StripStyles.Add(stripStyle);

            chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = dateTimeScale;
            chart.Axis(StandardAxis.PrimaryY).Anchor            = new NDockAxisAnchor(AxisDockZone.FrontRight, true, 0, 100);

            // label the X axis
            NOrdinalScaleConfigurator ordinalScale = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;

            ordinalScale.AutoLabels = false;
            ordinalScale.Labels.Add("Market Research");
            ordinalScale.Labels.Add("Specifications");
            ordinalScale.Labels.Add("Architecture");
            ordinalScale.Labels.Add("Project Planning");
            ordinalScale.Labels.Add("Detailed Design");
            ordinalScale.Labels.Add("Development");
            ordinalScale.Labels.Add("Test Plan");
            ordinalScale.Labels.Add("Testing and QA");
            ordinalScale.Labels.Add("Documentation");

            // create a floatbar series
            NFloatBarSeries floatBar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar);

            floatBar.BeginValues.ValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.Date);
            floatBar.EndValues.ValueFormatter   = new NDateTimeValueFormatter(DateTimeValueFormat.Date);
            floatBar.DataLabelStyle.Visible     = false;

            AddDataPoint(floatBar, new DateTime(2009, 2, 2), new DateTime(2009, 2, 16));
            AddDataPoint(floatBar, new DateTime(2009, 2, 16), new DateTime(2009, 3, 2));
            AddDataPoint(floatBar, new DateTime(2009, 3, 2), new DateTime(2009, 3, 16));
            AddDataPoint(floatBar, new DateTime(2009, 3, 9), new DateTime(2009, 3, 23));
            AddDataPoint(floatBar, new DateTime(2009, 3, 16), new DateTime(2009, 3, 30));
            AddDataPoint(floatBar, new DateTime(2009, 3, 23), new DateTime(2009, 4, 27));
            AddDataPoint(floatBar, new DateTime(2009, 4, 13), new DateTime(2009, 4, 27));
            AddDataPoint(floatBar, new DateTime(2009, 4, 20), new DateTime(2009, 5, 4));
            AddDataPoint(floatBar, new DateTime(2009, 4, 27), new DateTime(2009, 5, 4));

            // apply layout
            ConfigureStandardLayout(chart, title, null);

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

            styleSheet.Apply(nChartControl1.Document);
        }
Beispiel #28
0
        public NevChartUC( )
        {
            InitializeComponent();

            // set a chart title
            NLabel title = nevronChart.Labels.AddHeader("Stick Stock Chart");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);
            title.TextStyle.FillStyle = new NColorFillStyle(Color.Blue);

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

            // setup chart
            chart = nevronChart.Charts[0];

            // setup X axis
            NValueTimelineScaleConfigurator scaleX = new NValueTimelineScaleConfigurator();

            scaleX.FirstRow.GridStyle.ShowAtWalls   = new ChartWallType[] { ChartWallType.Back };
            scaleX.FirstRow.GridStyle.LineStyle     = new NStrokeStyle(1, Color.FromArgb(225, 225, 225));
            scaleX.FirstRow.UseGridStyle            = true;
            scaleX.FirstRow.InnerTickStyle.Visible  = false;
            scaleX.SecondRow.GridStyle.ShowAtWalls  = new ChartWallType[] { ChartWallType.Back };
            scaleX.SecondRow.GridStyle.LineStyle    = new NStrokeStyle(1, Color.FromArgb(215, 215, 215));
            scaleX.SecondRow.UseGridStyle           = true;
            scaleX.SecondRow.InnerTickStyle.Visible = false;
            scaleX.ThirdRow.GridStyle.ShowAtWalls   = new ChartWallType[] { ChartWallType.Back };
            scaleX.ThirdRow.GridStyle.LineStyle     = new NStrokeStyle(1, Color.FromArgb(205, 205, 205));
            scaleX.ThirdRow.UseGridStyle            = true;
            scaleX.ThirdRow.InnerTickStyle.Visible  = false;
            // calendar
            NWeekDayRule wdr = new NWeekDayRule(WeekDayBit.All);

            wdr.Saturday = false;
            wdr.Sunday   = false;
            scaleX.Calendar.Rules.Add(wdr);
            scaleX.EnableCalendar = true;
            // set configurator
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX;

            // setup Y axis
            NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;

            scaleY.OuterMajorTickStyle.Length  = new NLength(3, NGraphicsUnit.Point);
            scaleY.InnerMajorTickStyle.Visible = false;

            NFillStyle       stripFill  = new NColorFillStyle(Color.FromArgb(234, 233, 237));
            NScaleStripStyle stripStyle = new NScaleStripStyle(stripFill, null, true, 1, 0, 1, 1);

            stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
            stripStyle.Interlaced  = true;
            scaleY.StripStyles.Add(stripStyle);

            // add a stock series
            m_Stock                        = (NStockSeries)chart.Series.Add(SeriesType.Stock);
            m_Stock.CandleStyle            = CandleStyle.Stick;
            m_Stock.DataLabelStyle.Visible = false;
            m_Stock.UpStrokeStyle.Width    = new NLength(1, NGraphicsUnit.Point);
            m_Stock.UpStrokeStyle.Color    = Color.Black;
            m_Stock.DownStrokeStyle.Width  = new NLength(1, NGraphicsUnit.Point);
            m_Stock.DownStrokeStyle.Color  = Color.Crimson;
            m_Stock.CandleWidth            = new NLength(1.3f, NRelativeUnit.ParentPercentage);
            m_Stock.UseXValues             = true;
            m_Stock.InflateMargins         = true;

            // apply layout
            ConfigureStandardLayout(chart, title, null);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // fill the combo
                LineStyleDropDownList.Items.Add("Line");
                LineStyleDropDownList.Items.Add("Tape");
                LineStyleDropDownList.Items.Add("Tube");
                LineStyleDropDownList.Items.Add("Ellipsoid");
                LineStyleDropDownList.SelectedIndex = 0;

                WebExamplesUtilities.FillComboWithEnumValues(MarkerShapeDropDownList, typeof(PointShape));
                MarkerShapeDropDownList.SelectedIndex = 1;

                WebExamplesUtilities.FillComboWithPercents(LineDepthDropDownList, 10);
                LineDepthDropDownList.SelectedIndex = 4;

                WebExamplesUtilities.FillComboWithValues(LineWidthDropDownList, 0, 5, 1);
                LineWidthDropDownList.SelectedIndex = 1;

                WebExamplesUtilities.FillComboWithColorNames(LineColorDropDownList, KnownColor.DarkSalmon);
                WebExamplesUtilities.FillComboWithColorNames(LineFillColorDropDownList, KnownColor.LightSalmon);

                WebExamplesUtilities.FillComboWithValues(MarkerSizeDropDownList, 0, 10, 1);
                MarkerSizeDropDownList.SelectedIndex = 2;

                ShowMarkersCheckBox.Checked         = true;
                LeftAxisRoundToTickCheckBox.Checked = true;
            }

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

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

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

            NChart chart = nChartControl1.Charts[0];

            chart.Enable3D = true;
            chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective2);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
            chart.Axis(StandardAxis.Depth).Visible = false;

            // setup Y axis
            NLinearScaleConfigurator scaleY = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;

            scaleY.RoundToTickMin = LeftAxisRoundToTickCheckBox.Checked;
            scaleY.RoundToTickMax = LeftAxisRoundToTickCheckBox.Checked;

            // add Y axis interlaced stripe
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            scaleY.StripStyles.Add(stripStyle);

            // setup X axis
            NOrdinalScaleConfigurator scaleX = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;

            scaleX.MajorTickMode = MajorTickMode.AutoMaxCount;
            scaleX.DisplayDataPointsBetweenTicks = false;

            // setup the line series
            NLineSeries nLine = (NLineSeries)chart.Series.Add(SeriesType.Line);

            nLine.Values.FillRandom(Random, 10);
            nLine.DataLabelStyle.Visible = false;
            nLine.Legend.Mode            = SeriesLegendMode.DataPoints;

            nLine.BorderStyle.Width = new NLength(LineWidthDropDownList.SelectedIndex, NGraphicsUnit.Pixel);
            nLine.DepthPercent      = LineDepthDropDownList.SelectedIndex * 10;
            nLine.BorderStyle.Color = WebExamplesUtilities.ColorFromDropDownList(LineColorDropDownList);
            nLine.FillStyle         = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(LineFillColorDropDownList));

            nLine.InflateMargins      = InflateMarginsCheckBox.Checked;
            nLine.MarkerStyle.Visible = ShowMarkersCheckBox.Checked;

            bool bSimpleLine = (LineStyleDropDownList.SelectedIndex == 0);

            switch (LineStyleDropDownList.SelectedIndex)
            {
            case 0:                     // simple line
                nLine.LineSegmentShape = LineSegmentShape.Line;
                break;

            case 1:                     // tape
                nLine.LineSegmentShape = LineSegmentShape.Tape;
                break;

            case 2:                     // tube
                nLine.LineSegmentShape = LineSegmentShape.Tube;
                break;

            case 3:                     // elipsoid
                nLine.LineSegmentShape = LineSegmentShape.Ellipsoid;
                break;
            }

            LineDepthDropDownList.Enabled     = !bSimpleLine;
            LineFillColorDropDownList.Enabled = !bSimpleLine;

            MarkerShapeDropDownList.Enabled = ShowMarkersCheckBox.Checked;
            MarkerSizeDropDownList.Enabled  = ShowMarkersCheckBox.Checked;

            if (nLine.MarkerStyle.Visible)
            {
                nLine.MarkerStyle.PointShape        = (PointShape)MarkerShapeDropDownList.SelectedIndex;
                nLine.MarkerStyle.Height            = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage);
                nLine.MarkerStyle.Width             = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage);
                nLine.MarkerStyle.FillStyle         = new NColorFillStyle(Red);
                nLine.MarkerStyle.BorderStyle.Color = WebExamplesUtilities.ColorFromDropDownList(LineColorDropDownList);
            }

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
        public override void Initialize()
        {
            base.Initialize();

            // set a chart title
            NLabel title = new NLabel("Stack Float Bar");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);

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

            chart.Enable3D = true;
            chart.Width    = 65;
            chart.Height   = 40;
            chart.Axis(StandardAxis.Depth).Visible = false;
            chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);

            // add interlaced stripe to the Y axis
            NLinearScaleConfigurator scaleY     = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;
            NScaleStripStyle         stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Left };
            stripStyle.Interlaced  = true;
            scaleY.StripStyles.Add(stripStyle);

            // setup the floatbar series
            NFloatBarSeries floatbar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar);

            floatbar.MultiFloatBarMode = MultiFloatBarMode.Series;
            floatbar.Name      = "Floatbar series";
            floatbar.FillStyle = new NColorFillStyle(Color.SandyBrown);
            floatbar.DataLabelStyle.Visible = false;

            // setup the bar series
            NBarSeries bar1 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar1.Name                   = "Bar series";
            bar1.MultiBarMode           = MultiBarMode.Stacked;
            bar1.FillStyle              = new NColorFillStyle(Color.Green);
            bar1.DataLabelStyle.Visible = false;

            // setup the bar series
            NBarSeries bar2 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar2.Name                   = "Bar series";
            bar2.MultiBarMode           = MultiBarMode.Stacked;
            bar2.FillStyle              = new NColorFillStyle(Color.CornflowerBlue);
            bar2.DataLabelStyle.Visible = false;

            GeneratePosData();

            // apply layout
            ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]);

            // init form controls
            BarShapeCombo.FillFromEnum(typeof(BarShape));
            BarShapeCombo.SelectedIndex = 0;

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

            styleSheet.Apply(nChartControl1.Document);
        }
Beispiel #31
0
        private void Init2dChart()
        {
            nChartControl2.Settings.ShapeRenderingMode = ShapeRenderingMode.HighSpeed;
            nChartControl2.Legends.Clear(); // no legend
            NChart chart2d = nChartControl2.Charts[0];

            NSmoothLineSeries surface = null;
            if (chart2d.Series.Count == 0)
            {
                surface = (NSmoothLineSeries)chart2d.Series.Add(SeriesType.SmoothLine);
            }
            else
            {
                surface = (NSmoothLineSeries)chart2d.Series[0];
            }

            chart2d.BoundsMode = BoundsMode.Stretch;
            NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart2d.Axis(StandardAxis.PrimaryY).ScaleConfigurator;
            linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);
            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.StripStyles.Add(stripStyle);
            NSmoothLineSeries line = null;
            if (chart2d.Series.Count == 0)
            {
                line = (NSmoothLineSeries)chart2d.Series.Add(SeriesType.SmoothLine);
            }
            else
            {
                line = (NSmoothLineSeries)chart2d.Series[0];
            }
            line.Name = m_map_name;
            line.Legend.Mode = SeriesLegendMode.Series;
            line.UseXValues = true;
            line.UseZValues = false;
            line.DataLabelStyle.Visible = true;
            line.MarkerStyle.Visible = true;
            line.MarkerStyle.PointShape = PointShape.Sphere;
            line.MarkerStyle.AutoDepth = true;
            line.MarkerStyle.Width = new NLength(1.4f, NRelativeUnit.ParentPercentage);
            line.MarkerStyle.Height = new NLength(1.4f, NRelativeUnit.ParentPercentage);
            line.MarkerStyle.Depth = new NLength(1.4f, NRelativeUnit.ParentPercentage);
            //line.HorizontalAxes = y_axisvalues;

            surface.Name = "Surface";
            //surface.Legend.Mode = SeriesLegendMode.SeriesLogic;
            //surface.PositionValue = 10.0;
            for (int i = 0; i < y_axisvalues.Length; i++)
            {
                surface.XValues.Add(y_axisvalues.GetValue(i));
            }
            NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Nevron);
            styleSheet.Apply(nChartControl2.Document);
        }
Beispiel #32
0
        /*Построение 2д графика*/
        public void Draw2D(bool exp)
        {
            int numFromPoint = numberOfPointY();
            mainForm.nChartControl1.Clear();
            mainForm.nChartControl1.Controller.Tools.Add(new NSelectorTool());
            mainForm.nChartControl1.Controller.Tools.Add(new NTrackballTool());
            var chart = (NCartesianChart) mainForm.nChartControl1.Charts[0];
            mainForm.nChartControl1.Legends[0].Mode = LegendMode.Disabled;
            chart.BoundsMode = BoundsMode.Stretch;
            var scaleConfiguratorY1 = (NStandardScaleConfigurator) chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;
            var scaleConfiguratorX1 = (NStandardScaleConfigurator) chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator;
            scaleConfiguratorY1.Title.Text = mainForm.dgwExperiment.Columns[1].HeaderCell.Value.ToString();
            scaleConfiguratorY1.Title.TextStyle = new NTextStyle(new Font("Microsoft Sans Serif", 10, FontStyle.Bold));
            scaleConfiguratorY1.LabelStyle.TextStyle =
                new NTextStyle(new Font("Microsoft Sans Serif", 10, FontStyle.Bold));
            scaleConfiguratorX1.Title.Text = mainForm.dgwExperiment.Columns[0].HeaderCell.Value.ToString();
            scaleConfiguratorX1.Title.TextStyle = new NTextStyle(new Font("Microsoft Sans Serif", 10, FontStyle.Bold));
            scaleConfiguratorX1.LabelStyle.TextStyle =
                new NTextStyle(new Font("Microsoft Sans Serif", 10, FontStyle.Bold));
            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(78, NRelativeUnit.ParentPercentage));
            NLinearScaleConfigurator linearScale =
                (NLinearScaleConfigurator) chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;
            linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);
            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.StripStyles.Add(stripStyle);
            NSmoothLineSeries line = (NSmoothLineSeries) chart.Series.Add(SeriesType.SmoothLine);
            line.Name = "Smooth Line";
            line.InflateMargins = true;
            line.Legend.Mode = SeriesLegendMode.Series;
            line.UseXValues = true;
            line.UseZValues = false;
            line.DataLabelStyle.Visible = false;
            line.MarkerStyle.Visible = false;

            double firstMin = Convert.ToDouble(mainForm.graphSettings.txtFirstParamMin.Text);
            double firstMax = Convert.ToDouble(mainForm.graphSettings.txtFirstParamMax.Text);
            double firstStep = Convert.ToDouble(mainForm.graphSettings.txtStepChart.Text);
            resultForm.dataGridView1.Columns.Clear();

            int c = 0;
            for (double i = firstMin; i < firstMax + firstStep; i += firstStep)
            {
                if (i > firstMax - firstStep)
                {
                    i = firstMax;
                }

                double[] data = { i };
                double yPoint = Ymath(data);
                line.Values.Add(yPoint);
                line.XValues.Add(i);

                resultForm.dataGridView1.Columns.Add(i.ToString(), i.ToString());
                resultForm.dataGridView1.Rows[0].Cells[c].Value = Math.Round(yPoint, numFromPoint).ToString().Replace(".", ",");
                c++;
            }

            resultForm.dataGridView1.TopLeftHeaderCell.Value = "x";
            resultForm.dataGridView1.Rows[0].HeaderCell.Value = "y";

            if (exp)
            {
                mainForm.DrawExpPoints2D();
            }
        }