Пример #1
0
        public override void Initialize()
        {
            base.Initialize();

            m_ImageFrameStyle = new NImageFrameStyle();
            nChartControl1.BackgroundStyle.FrameStyle = m_ImageFrameStyle;
            ImageFrameStyleEditorUC.Style             = m_ImageFrameStyle;

            nChartControl1.BackgroundStyle.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant2, Color.AliceBlue, Color.LightGray);

            NLabel title = new NLabel("Image Background Frame");

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

            NChart chart = nChartControl1.Charts[0];

            NAreaSeries area = (NAreaSeries)chart.Series.Add(SeriesType.Area);

            area.DataLabelStyle.Visible = false;
            area.FillStyle = new NColorFillStyle(DarkOrange);
            area.Values.AddRange(monthValues);

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

            BackgroundFillStyleComboBox.Items.Add("Solid color");
            BackgroundFillStyleComboBox.Items.Add("Gradient");
            BackgroundFillStyleComboBox.Items.Add("Image");
            BackgroundFillStyleComboBox.Items.Add("Pattern");
            BackgroundFillStyleComboBox.Items.Add("AdvancedGradient");
            BackgroundFillStyleComboBox.SelectedIndex = 1;
        }
Пример #2
0
        private void InitDocument()
        {
            // setup document background
            NImageFrameStyle imageFrame = new NImageFrameStyle();

            imageFrame.Type                     = ImageFrameType.RoundedTop;
            imageFrame.FillStyle                = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.FromArgb(166, 166, 166), Color.FromArgb(211, 211, 211));
            imageFrame.ShadowStyle.Type         = ShadowType.GaussianBlur;
            imageFrame.BackgroundColor          = view.WindowBackColor;    // in order for shadow to blend nicely use the same backcolor
            document.BackgroundStyle.FrameStyle = imageFrame;

            CreateElements();
            CreateLabels();
            CreateLegend();
        }
        private NBackgroundDecoratorPanel CreateStatusMeterPanel(string labelText, NPointL location, NRangeIndicator rangeIndicator)
        {
            NBackgroundDecoratorPanel backgroundPanel = new NBackgroundDecoratorPanel();

            backgroundPanel.Location = location;
            backgroundPanel.Size     = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage),
                                                  new NLength(20, NRelativeUnit.ParentPercentage));

            NImageFrameStyle imageFrameStyle = new NImageFrameStyle(PredefinedImageFrame.Embed);

            imageFrameStyle.BackgroundColor            = Color.Transparent;
            imageFrameStyle.ShadowStyle.Type           = ShadowType.None;
            imageFrameStyle.FillStyle                  = new NColorFillStyle(Color.Transparent);
            backgroundPanel.BackgroundStyle.FillStyle  = new NColorFillStyle(Color.White);
            backgroundPanel.BackgroundStyle.FrameStyle = imageFrameStyle;

            NDockPanel contentPanel = new NDockPanel();

            contentPanel.DockMargins = new NMarginsL(new NLength(15), new NLength(3), new NLength(15), new NLength(3));
            contentPanel.DockMode    = PanelDockMode.Fill;
            backgroundPanel.ChildPanels.Add(contentPanel);

            NLabel label = new NLabel();

            label.DockMode         = PanelDockMode.Bottom;
            label.Text             = labelText;
            label.ContentAlignment = ContentAlignment.MiddleLeft;
            label.DockMargins      = new NMarginsL(new NLength(0), new NLength(0), new NLength(0), new NLength(0));
            label.BoundsMode       = BoundsMode.Fit;
            contentPanel.ChildPanels.Add(label);

            NLinearGaugePanel linearGauge = new NLinearGaugePanel();

            linearGauge.Indicators.Add(rangeIndicator);
            linearGauge.DockMode    = PanelDockMode.Fill;
            linearGauge.DockMargins = new NMarginsL(new NLength(15), new NLength(0), new NLength(15), new NLength(0));

            NGaugeAxis axis = (NGaugeAxis)linearGauge.Axes[0];

            axis.Anchor = new NModelGaugeAxisAnchor();
            NStandardScaleConfigurator configurator = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            configurator.SetPredefinedScaleStyle(PredefinedScaleStyle.Scientific);
            contentPanel.ChildPanels.Add(linearGauge);

            return(backgroundPanel);
        }
        protected NBackgroundDecoratorPanel CreateBackgroundPanel()
        {
            NBackgroundStyle backroundStyle = new NBackgroundStyle();

            backroundStyle.FillStyle = new NColorFillStyle(Color.Transparent);
            NImageFrameStyle frameStyle = new NImageFrameStyle();

            frameStyle.BackgroundColor   = Color.Transparent;
            frameStyle.Type              = ImageFrameType.Raised;
            frameStyle.BorderStyle.Width = new NLength(0);
            backroundStyle.FrameStyle    = frameStyle;

            NBackgroundDecoratorPanel backgroundPanel = new NBackgroundDecoratorPanel();

            backgroundPanel.DockMargins     = new NMarginsL(new NLength(5, NGraphicsUnit.Point), new NLength(5, NGraphicsUnit.Point), new NLength(5, NGraphicsUnit.Point), new NLength(5, NGraphicsUnit.Point));
            backgroundPanel.BackgroundStyle = (NBackgroundStyle)backroundStyle.Clone();

            return(backgroundPanel);
        }
        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();
            }
        }
Пример #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!NThinChartControl1.Initialized)
            {
                // enable jittering (full scene antialiasing)
                NThinChartControl1.Settings.JitterMode = JitterMode.Enabled;
                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("Postback Tool");
                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));

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

                // add interlaced stripe for the Y axis
                NAxis axisY = chart.Axis(StandardAxis.PrimaryY);
                NLinearScaleConfigurator scaleY     = (NLinearScaleConfigurator)axisY.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);

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

                bar.AddDataPoint(new NDataPoint(16, "Spain"));
                bar.AddDataPoint(new NDataPoint(42, "France"));
                bar.AddDataPoint(new NDataPoint(56, "Germany"));
                bar.AddDataPoint(new NDataPoint(23, "Italy"));
                bar.AddDataPoint(new NDataPoint(47, "UK"));
                bar.AddDataPoint(new NDataPoint(38, "Sweden"));

                for (int i = 0; i < bar.Values.Count; i++)
                {
                    bar.InteractivityStyles[i] = new NInteractivityStyle("Click on bar to make it red");
                }

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

                NThinChartControl1.Controller.Tools.Add(new NPostbackTool());
            }

            NThinChartControl1.Postback += new NPostbackEventHandler(NThinChartControl1_Postback);
            NThinChartControl1.Controller.Tools.Clear();

            NTooltipTool tooltipTool = new NTooltipTool();

            NThinChartControl1.Controller.Tools.Add(tooltipTool);

            NPostbackTool postbackTool = new NPostbackTool();

            postbackTool.PostbackOnlyOnInteractiveItems = PostbackOnlyOnInteractiveItemsCheckBox.Checked;
            NThinChartControl1.Controller.Tools.Add(postbackTool);
        }
        public override void Initialize(NThinChartControl control)
        {
            // enable jittering (full scene antialiasing)
            control.Settings.JitterMode = JitterMode.Enabled;
            control.Panels.Clear();

            // apply background image border
            NImageFrameStyle frame = new NImageFrameStyle();

            frame.Type                         = ImageFrameType.Raised;
            frame.BackgroundColor              = Color.White;
            frame.BorderStyle.Color            = Color.Gainsboro;
            control.BackgroundStyle.FrameStyle = frame;
            control.BackgroundStyle.FillStyle  = new NGradientFillStyle(Color.White, Color.GhostWhite);

            // set a chart title
            NLabel title = new NLabel("Welcome to Nevron Chart for .NET");

            control.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();

            control.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();

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

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

            scaleX.MajorTickMode = MajorTickMode.AutoMaxCount;

            // add interlaced stripe for the Y axis
            NAxis axisY = chart.Axis(StandardAxis.PrimaryY);
            NLinearScaleConfigurator scaleY     = (NLinearScaleConfigurator)axisY.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);

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

            bar.AddDataPoint(new NDataPoint(16, "Spain"));
            bar.AddDataPoint(new NDataPoint(42, "France"));
            bar.AddDataPoint(new NDataPoint(56, "Germany"));
            bar.AddDataPoint(new NDataPoint(23, "Italy"));
            bar.AddDataPoint(new NDataPoint(47, "UK"));
            bar.AddDataPoint(new NDataPoint(38, "Sweden"));

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

            styleSheet.Apply(bar);

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

            //control.Controller.EnableAutoUpdate = true;
            NTrackballTool tbt = new NTrackballTool();

            tbt.Exclusive = true;
            tbt.Enabled   = true;
            control.Controller.Tools.Add(tbt);

            control.Toolbar.Visible = true;
            control.Toolbar.Items.Add(new NToolbarButton(new NToggleTrackballToolAction()));
        }
Пример #8
0
        public override void Initialize()
        {
            base.Initialize();

            Nevron.UI.WinForm.Controls.NPalette palette = Nevron.UI.WinForm.Controls.NUIManager.Palette;

            // Clear the chart panels
            nChartControl1.Panels.Clear();
            // Create a background style to assign to the new panels
            NBackgroundStyle backroundStyle = new NBackgroundStyle();

            backroundStyle.FillStyle = new NColorFillStyle(Color.Transparent);
            NImageFrameStyle frameStyle = new NImageFrameStyle();

            frameStyle.BorderStyle.Color = palette.ControlDark;
            frameStyle.BackgroundColor   = Color.Transparent;
            frameStyle.Type           = ImageFrameType.Raised;
            backroundStyle.FrameStyle = frameStyle;

            // Create the label background panel
            m_LabelBackgroundPanel                 = new NBackgroundDecoratorPanel();
            m_LabelBackgroundPanel.Size            = new NSizeL(new NLength(0, NGraphicsUnit.Pixel), new NLength(10, NRelativeUnit.ParentPercentage));
            m_LabelBackgroundPanel.DockMode        = PanelDockMode.Top;
            m_LabelBackgroundPanel.DockMargins     = new NMarginsL(new NLength(5, NGraphicsUnit.Point), new NLength(5, NGraphicsUnit.Point), new NLength(5, NGraphicsUnit.Point), new NLength(5, NGraphicsUnit.Point));
            m_LabelBackgroundPanel.BackgroundStyle = (NBackgroundStyle)backroundStyle.Clone();
            nChartControl1.Panels.Add(m_LabelBackgroundPanel);

            // Create the legend background panel
            m_LegendBackgroundPanel                 = new NBackgroundDecoratorPanel();
            m_LegendBackgroundPanel.Size            = new NSizeL(new NLength(20, NRelativeUnit.ParentPercentage), new NLength(0, NGraphicsUnit.Pixel));
            m_LegendBackgroundPanel.DockMode        = PanelDockMode.Right;
            m_LegendBackgroundPanel.BackgroundStyle = (NBackgroundStyle)backroundStyle.Clone();
            m_LegendBackgroundPanel.DockMargins     = new NMarginsL(new NLength(5, NGraphicsUnit.Point), new NLength(5, NGraphicsUnit.Point), new NLength(5, NGraphicsUnit.Point), new NLength(5, NGraphicsUnit.Point));
            nChartControl1.Panels.Add(m_LegendBackgroundPanel);

            // Create the chart background panel
            NBackgroundDecoratorPanel chartBackgroundPanel = new NBackgroundDecoratorPanel();

            chartBackgroundPanel.BackgroundStyle = (NBackgroundStyle)backroundStyle.Clone();
            chartBackgroundPanel.DockMode        = PanelDockMode.Fill;
            chartBackgroundPanel.DockMargins     = new NMarginsL(new NLength(5, NGraphicsUnit.Point), new NLength(5, NGraphicsUnit.Point), new NLength(5, NGraphicsUnit.Point), new NLength(5, NGraphicsUnit.Point));
            nChartControl1.Panels.Add(chartBackgroundPanel);

            // Create the header label and host it in the label background panel
            NLabel title = new NLabel("Background Decorator Panel");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);
            title.TextStyle.FillStyle = new NColorFillStyle(Color.SlateGray);
            title.ContentAlignment    = ContentAlignment.MiddleCenter;
            title.DockMode            = PanelDockMode.Fill;
            title.BoundsMode          = BoundsMode.Fit;
            title.Location            = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));
            title.DockMargins         = new NMarginsL(frameStyle.LightEffectSize, frameStyle.LightEffectSize, frameStyle.LightEffectSize, frameStyle.LightEffectSize);

            m_LabelBackgroundPanel.ChildPanels.Add(title);

            // Create the legend and host it in the legend background panel
            NLegend legend = new NLegend();

            legend.DockMode         = PanelDockMode.Fill;
            legend.ContentAlignment = ContentAlignment.MiddleCenter;
            legend.DockMargins      = new NMarginsL(frameStyle.LightEffectSize, frameStyle.LightEffectSize, frameStyle.LightEffectSize, frameStyle.LightEffectSize);
            m_LegendBackgroundPanel.ChildPanels.Add(legend);

            // Create a cartesian chart and host it in the chart background panel
            NChart chart = new NCartesianChart();

            chartBackgroundPanel.ChildPanels.Add(chart);
            chart.DisplayOnLegend = legend;
            chart.BoundsMode      = BoundsMode.Stretch;

            // add bar and change bar color
            NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar.Name                   = "Bar Series";
            bar.Legend.Mode            = SeriesLegendMode.DataPoints;
            bar.ShadowStyle.Type       = ShadowType.GaussianBlur;
            bar.ShadowStyle.Offset     = new NPointL(3, 3);
            bar.ShadowStyle.Color      = Color.FromArgb(80, 0, 0, 0);
            bar.ShadowStyle.FadeLength = new NLength(5);

            // add some data to the bar series
            bar.AddDataPoint(new NDataPoint(18, "C++"));
            bar.AddDataPoint(new NDataPoint(15, "Ruby"));
            bar.AddDataPoint(new NDataPoint(21, "Python"));
            bar.AddDataPoint(new NDataPoint(23, "Java"));
            bar.AddDataPoint(new NDataPoint(27, "Javascript"));
            bar.AddDataPoint(new NDataPoint(29, "C#"));
            bar.AddDataPoint(new NDataPoint(26, "PHP"));

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

            styleSheet.Apply(nChartControl1.Document);

            // init form controls
            DockTitleComboBox.Items.Add("Top");
            DockTitleComboBox.Items.Add("Bottom");
            DockTitleComboBox.SelectedIndex = 0;

            DockLegendComboBox.Items.Add("Left");
            DockLegendComboBox.Items.Add("Right");
            DockLegendComboBox.SelectedIndex = 1;
        }
Пример #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Clear the chart panels
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            NStandardFrameStyle controlFrameStyle = new NStandardFrameStyle();

            controlFrameStyle.OuterBorderWidth        = new NLength(0);
            controlFrameStyle.InnerBorderWidth        = new NLength(0);
            nChartControl1.BackgroundStyle.FrameStyle = controlFrameStyle;
            nChartControl1.Panels.Clear();

            // Create a background style to assign to the new panels
            NBackgroundStyle backroundStyle = new NBackgroundStyle();

            backroundStyle.FillStyle = new NColorFillStyle(Color.Transparent);
            NImageFrameStyle frameStyle = new NImageFrameStyle();

            frameStyle.BorderStyle = new NStrokeStyle(0, Color.White);
            //frameStyle.BorderStyle.Color = Color.Gray;
            frameStyle.BackgroundColor = Color.Transparent;
            frameStyle.Type            = ImageFrameType.Raised;
            backroundStyle.FrameStyle  = frameStyle;

            //Create a shadow style to assign to some items
            NShadowStyle shadowStyle = new NShadowStyle();

            shadowStyle.Type       = ShadowType.LinearBlur;
            shadowStyle.Color      = Color.FromArgb(80, 0, 0, 0);
            shadowStyle.FadeLength = new NLength(1);
            shadowStyle.Offset     = new NPointL(2, 2);

            // Create the label background panel
            NBackgroundDecoratorPanel labelBackgroundPanel = new NBackgroundDecoratorPanel();

            labelBackgroundPanel.Size            = new NSizeL(new NLength(0, NGraphicsUnit.Pixel), new NLength(15, NRelativeUnit.ParentPercentage));
            labelBackgroundPanel.DockMode        = PanelDockMode.Top;
            labelBackgroundPanel.DockMargins     = new NMarginsL(new NLength(3, NGraphicsUnit.Point), new NLength(3, NGraphicsUnit.Point), new NLength(3, NGraphicsUnit.Point), new NLength(3, NGraphicsUnit.Point));
            labelBackgroundPanel.BackgroundStyle = (NBackgroundStyle)backroundStyle.Clone();
            nChartControl1.Panels.Add(labelBackgroundPanel);

            // Create the legend background panel
            NBackgroundDecoratorPanel legendBackgroundPanel = new NBackgroundDecoratorPanel();

            legendBackgroundPanel.Size            = new NSizeL(new NLength(30, NRelativeUnit.ParentPercentage), new NLength(0, NGraphicsUnit.Pixel));
            legendBackgroundPanel.DockMode        = PanelDockMode.Right;
            legendBackgroundPanel.BackgroundStyle = (NBackgroundStyle)backroundStyle.Clone();
            legendBackgroundPanel.DockMargins     = new NMarginsL(new NLength(3, NGraphicsUnit.Point), new NLength(3, NGraphicsUnit.Point), new NLength(3, NGraphicsUnit.Point), new NLength(3, NGraphicsUnit.Point));
            nChartControl1.Panels.Add(legendBackgroundPanel);

            // Create the chart background panel
            NBackgroundDecoratorPanel chartBackgroundPanel = new NBackgroundDecoratorPanel();

            chartBackgroundPanel.BackgroundStyle = (NBackgroundStyle)backroundStyle.Clone();
            chartBackgroundPanel.DockMode        = PanelDockMode.Fill;
            chartBackgroundPanel.DockMargins     = new NMarginsL(new NLength(3, NGraphicsUnit.Point), new NLength(3, NGraphicsUnit.Point), new NLength(3, NGraphicsUnit.Point), new NLength(3, NGraphicsUnit.Point));
            nChartControl1.Panels.Add(chartBackgroundPanel);

            // Create the header label and host it in the label background panel
            NLabel header = new NLabel("Background Decorator Panel");

            header.TextStyle.FontStyle   = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            header.TextStyle.ShadowStyle = (NShadowStyle)shadowStyle.Clone();
            header.TextStyle.FillStyle   = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.LightBlue, Color.DarkSlateBlue);
            header.ContentAlignment      = ContentAlignment.MiddleCenter;
            header.DockMode    = PanelDockMode.Fill;
            header.BoundsMode  = BoundsMode.Fit;
            header.Location    = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));
            header.DockMargins = new NMarginsL(frameStyle.LightEffectSize, frameStyle.LightEffectSize, frameStyle.LightEffectSize, frameStyle.LightEffectSize);
            labelBackgroundPanel.ChildPanels.Add(header);

            // Create the legend and host it in the legend background panel
            NLegend legend = new NLegend();

            legend.DockMode         = PanelDockMode.Fill;
            legend.ContentAlignment = ContentAlignment.MiddleCenter;
            legend.DockMargins      = new NMarginsL(frameStyle.LightEffectSize, frameStyle.LightEffectSize, frameStyle.LightEffectSize, frameStyle.LightEffectSize);
            legend.FillStyle        = new NColorFillStyle(new NArgbColor(0, Color.White));
            NStrokeStyle borderStyle = new NStrokeStyle(0, Color.White);

            legend.HorizontalBorderStyle  = borderStyle;
            legend.VerticalBorderStyle    = borderStyle;
            legend.OuterBottomBorderStyle = borderStyle;
            legend.OuterLeftBorderStyle   = borderStyle;
            legend.OuterRightBorderStyle  = borderStyle;
            legend.OuterTopBorderStyle    = borderStyle;
            legendBackgroundPanel.ChildPanels.Add(legend);

            // Create a cartesian chart and host it in the chart background panel
            NChart chart = new NCartesianChart();

            chartBackgroundPanel.ChildPanels.Add(chart);

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

            // add bar and change bar color
            NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar.Name                   = "Bar Series";
            bar.FillStyle              = new NGradientFillStyle(GradientStyle.Vertical, GradientVariant.Variant2, Color.DarkRed, Color.Red);
            bar.BorderStyle.Width      = new NLength(0, NGraphicsUnit.Pixel);
            bar.ShadowStyle            = (NShadowStyle)shadowStyle.Clone();
            bar.DataLabelStyle.Visible = false;

            bar.AddDataPoint(new NDataPoint(10, "Electronics", new NColorFillStyle(Color.Tomato)));
            bar.AddDataPoint(new NDataPoint(20, "Medical", new NColorFillStyle(Color.Orange)));
            bar.AddDataPoint(new NDataPoint(30, "Clothing", new NColorFillStyle(Color.Yellow)));
            bar.AddDataPoint(new NDataPoint(25, "Energy", new NColorFillStyle(Color.YellowGreen)));
            bar.AddDataPoint(new NDataPoint(29, "Financial", new NColorFillStyle(Color.ForestGreen)));
            bar.Legend.Mode = SeriesLegendMode.DataPoints;
            bar.Legend.TextStyle.ShadowStyle = (NShadowStyle)shadowStyle.Clone();

            // init form controls
            if (!IsPostBack)
            {
                DockTitleDropDownList.Items.Add("Top");
                DockTitleDropDownList.Items.Add("Bottom");
                DockTitleDropDownList.SelectedIndex = 0;

                DockLegendDropDownList.Items.Add("Left");
                DockLegendDropDownList.Items.Add("Right");
                DockLegendDropDownList.SelectedIndex = 1;
            }
            else
            {
                if (DockTitleDropDownList.SelectedIndex == 0)
                {
                    labelBackgroundPanel.DockMode = PanelDockMode.Top;
                }
                else
                {
                    labelBackgroundPanel.DockMode = PanelDockMode.Bottom;
                }

                if (DockLegendDropDownList.SelectedIndex == 0)
                {
                    legendBackgroundPanel.DockMode = PanelDockMode.Left;
                }
                else
                {
                    legendBackgroundPanel.DockMode = PanelDockMode.Right;
                }
            }
        }
Пример #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ImageBorderDropDownList.Items.Add("Common");
                ImageBorderDropDownList.Items.Add("Embed");
                ImageBorderDropDownList.Items.Add("Emboss");
                ImageBorderDropDownList.Items.Add("Rounded");
                ImageBorderDropDownList.Items.Add("RoundedBorder");
                ImageBorderDropDownList.Items.Add("Rectangular");
                ImageBorderDropDownList.Items.Add("Thin");
                ImageBorderDropDownList.Items.Add("Thick");
                ImageBorderDropDownList.Items.Add("OuterRounded");
                ImageBorderDropDownList.Items.Add("OpenLeft");
                ImageBorderDropDownList.Items.Add("OpenRight");

                WebExamplesUtilities.FillComboWithColorNames(BorderColorDropDownList, KnownColor.LightSteelBlue);
                WebExamplesUtilities.FillComboWithColorNames(FillingColorDropDownList, KnownColor.Snow);
                WebExamplesUtilities.FillComboWithColorNames(PageBackgroundColorDropDownList, KnownColor.White);
                HasShadowCheckBox.Checked = true;

                ImageBorderDropDownList.SelectedIndex = 6;
            }

            // set an image frame
            NImageFrameStyle imageFrameStyle = new NImageFrameStyle();

            imageFrameStyle.SetPredefinedFrameStyle((PredefinedImageFrame)(ImageBorderDropDownList.SelectedIndex));
            imageFrameStyle.FillStyle         = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(FillingColorDropDownList));
            imageFrameStyle.BorderStyle.Width = new NLength(1, NGraphicsUnit.Pixel);
            imageFrameStyle.BorderStyle.Color = WebExamplesUtilities.ColorFromDropDownList(BorderColorDropDownList);
            imageFrameStyle.BackgroundColor   = WebExamplesUtilities.ColorFromDropDownList(PageBackgroundColorDropDownList);
            imageFrameStyle.ShadowStyle.Type  = HasShadowCheckBox.Checked ? ShadowType.LinearBlur : ShadowType.None;

            nChartControl1.BackgroundStyle.FrameStyle = imageFrameStyle;

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

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

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

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

            // add the first bar
            NBarSeries bar1 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar1.MultiBarMode           = MultiBarMode.Series;
            bar1.DataLabelStyle.Visible = false;
            bar1.Values.FillRandomRange(Random, 5, 10, 40);

            // add the second bar
            NBarSeries bar2 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar2.MultiBarMode           = MultiBarMode.Stacked;
            bar2.DataLabelStyle.Visible = false;
            bar2.Values.FillRandomRange(Random, 5, 10, 40);

            // add the third bar
            NBarSeries bar3 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar3.MultiBarMode           = MultiBarMode.Stacked;
            bar3.DataLabelStyle.Visible = false;
            bar3.Values.FillRandomRange(Random, 5, 10, 40);

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

            styleSheet.Apply(nChartControl1.Document);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }