コード例 #1
0
        public override void Initialize()
        {
            base.Initialize();

            // set a chart title
            NLabel title = new NLabel("3D Bar Chart");

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

            // configure chart
            NCartesianChart chart = (NCartesianChart)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
            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.DataLabelStyle.Visible = true;
            bar.HasBottomEdge          = false;

            // 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 layout
            ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]);

            // init form controls
            StyleCombo.FillFromEnum(typeof(BarShape));
            StyleCombo.SelectedIndex      = (int)BarShape.SmoothEdgeBar;
            OriginModeCombo.SelectedIndex = 0;
            OriginValueTextBox.Text       = "0";
            EdgePercentScrollBar.Value    = (int)bar.BarEdgePercent;
            HasTopEdge.Checked            = bar.HasTopEdge;
            HasBottomEdge.Checked         = bar.HasBottomEdge;
            DifferentFillStyles.Checked   = true;
        }
コード例 #2
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = new NLabel("3D Bar Chart");

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

            // configure chart
            NCartesianChart chart = (NCartesianChart)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
            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.DataLabelStyle.Visible = true;
            bar.HasBottomEdge          = false;

            // 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 layout
            ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]);

            // init form controls
            NExampleHelpers.FillComboWithEnumValues(BarStyleComboBox, typeof(BarShape));
            BarStyleComboBox.SelectedIndex = 0;

            NExampleHelpers.FillComboWithValues(BarEdgePercentComboBox, 0, 50, 10);
            BarEdgePercentComboBox.SelectedIndex = 5;

            HasTopEdgeCheckBox.IsChecked          = bar.HasTopEdge;
            HasBottomEdgeCheckBox.IsChecked       = bar.HasBottomEdge;
            DifferentFIllStylesCheckBox.IsChecked = true;
            DifferentFillStylesCheckBox_Checked(null, null);
        }
コード例 #3
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // create a title
            NLabel title = new NLabel("2D Bar Chart");

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

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

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

            // 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, "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 layout
            ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]);

            // init form controls
            NExampleHelpers.FillComboWithEnumValues(BarStyleComboBox, typeof(BarShape));
            BarStyleComboBox.SelectedIndex = 0;

            NExampleHelpers.FillComboWithValues(BarEdgePercentComboBox, 0, 50, 10);
            BarEdgePercentComboBox.SelectedIndex = 5;

            HasTopEdgeCheckBox.IsChecked          = bar.HasTopEdge;
            HasBottomEdgeCheckBox.IsChecked       = bar.HasBottomEdge;
            DifferentFIllStylesCheckBox.IsChecked = true;
            DifferentFillStylesCheckBox_Checked(null, null);
        }
コード例 #4
0
        protected void ChangeData()
        {
            m_Bar.ClearDataPoints();

            NDataPoint dp = new NDataPoint();

            for (int i = 0; i < m_nBarCount; i++)
            {
                dp[DataPointValue.Value] = m_nBarCount / 2 - Random.Next(m_nBarCount);

                m_Bar.AddDataPoint(dp);
            }

            nChartControl1.Refresh();
        }
コード例 #5
0
        protected void ChangeData()
        {
            int        nBarCount = 10;
            NBarSeries bar       = (NBarSeries)nChartControl1.Charts[0].Series[0];

            bar.ClearDataPoints();

            NDataPoint dp = new NDataPoint();

            for (int i = 0; i < nBarCount; i++)
            {
                dp[DataPointValue.Value] = nBarCount / 2 - Random.Next(nBarCount);

                bar.AddDataPoint(dp);
            }
        }
コード例 #6
0
        public override void Initialize()
        {
            base.Initialize();

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

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

            // configure the chart
            m_Chart          = nChartControl1.Charts[0];
            m_Chart.Enable3D = true;
            m_Chart.Axis(StandardAxis.Depth).Visible = false;

            // apply lighting and projectection
            m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
            m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalHalf);

            // add interlaced stripe to the Y axis
            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;
            ((NStandardScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator).StripStyles.Add(stripStyle);

            // setup bar series
            m_Bar = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);
            m_Bar.DataLabelStyle.Visible = false;
            m_Bar.FillStyle = new NColorFillStyle(LightGreen);
            m_Bar.Name      = "Bar";

            // fill data
            m_Bar.AddDataPoint(new NDataPoint(10));
            m_Bar.AddDataPoint(new NDataPoint(20));
            m_Bar.AddDataPoint(new NDataPoint(30));

            // set an individual Fill Style and Stroke Style for data point #3
            NDataPoint dp = new NDataPoint(25);

            dp[DataPointValue.FillStyle]   = new NGradientFillStyle(LightOrange, DarkOrange);
            dp[DataPointValue.StrokeStyle] = new NStrokeStyle(1, DarkOrange, LinePattern.Dot, 0, 1);
            m_Bar.AddDataPoint(dp);

            m_Bar.AddDataPoint(new NDataPoint(29));
            m_Bar.AddDataPoint(new NDataPoint(27));

            // apply layout
            ConfigureStandardLayout(m_Chart, title, null);
        }
コード例 #7
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);
        }
コード例 #8
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();
            }
        }
コード例 #9
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);
        }
コード例 #10
0
        public override void Initialize()
        {
            base.Initialize();

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

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

            // disable legend
            nChartControl1.Legends[0].Mode = LegendMode.Disabled;

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

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

            // 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 bar series
            NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar.Name = "Bar Series";
            bar.DataLabelStyle.Visible = true;

            // 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.AutumnMultiColor);

            styleSheet.Apply(nChartControl1.Document);

            // init form controls
            DragModeComboBox.Items.Add("Disabled");
            DragModeComboBox.Items.Add("Trackball");
            DragModeComboBox.Items.Add("Zoom");
            DragModeComboBox.Items.Add("Offset");
            DragModeComboBox.SelectedIndex = 0;

            nChartControl1.Controller.Selection.Add(chart);

            UpdateControlsFromChart();
        }
コード例 #11
0
        public override void Initialize()
        {
            base.Initialize();

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

            title.TextStyle.TextFormat = TextFormat.XML;
            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));

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

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

            chart.Enable3D   = true;
            chart.BoundsMode = BoundsMode.Fit;

            // 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, "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.Charts[0]);

            // apply layout
            ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]);
        }
コード例 #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
            nChartControl1.Settings.JitterMode = JitterMode.Enabled;

            NHtmlImageMapResponse imageMapResponse = new NHtmlImageMapResponse();

            nChartControl1.ServerSettings.BrowserResponseSettings.DefaultResponse = imageMapResponse;

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

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

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

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

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

            bar.DataLabelStyle.Visible = false;
            bar.Legend.Mode            = SeriesLegendMode.DataPoints;
            bar.Legend.Format          = "<label> <percent>";

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

            // modify the axis labels
            NOrdinalScaleConfigurator ordinalScale = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator;

            ordinalScale.AutoLabels = false;

            for (int i = 0; i < bar.Labels.Count; i++)
            {
                ordinalScale.Labels.Add((string)bar.Labels[i]);
            }

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

            styleSheet.Apply(chart);

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

            // add interactivity styles with the urls to redirect to and the corresponding cursors and tooltips

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

            interactivityStyle.UrlLink.OpenInNewWindow = true;
            interactivityStyle.UrlLink.Url             = "../Examples/GettingStarted/NCarSalesPage.aspx";
            bar.InteractivityStyles[0] = interactivityStyle;

            interactivityStyle = new NInteractivityStyle("Click here to jump to Trains sales page", CursorType.Hand);
            interactivityStyle.UrlLink.OpenInNewWindow = true;
            interactivityStyle.UrlLink.Url             = "../Examples/GettingStarted/NTrainSalesPage.aspx";
            bar.InteractivityStyles[1] = interactivityStyle;

            interactivityStyle = new NInteractivityStyle("Click here to jump to Bus sales page", CursorType.Hand);
            interactivityStyle.UrlLink.OpenInNewWindow = true;
            interactivityStyle.UrlLink.Url             = "../Examples/GettingStarted/NBusSalesPage.aspx";
            bar.InteractivityStyles[2] = interactivityStyle;

            interactivityStyle = new NInteractivityStyle("Click here to jump to Ship sales page", CursorType.Hand);
            interactivityStyle.UrlLink.OpenInNewWindow = true;
            interactivityStyle.UrlLink.Url             = "../Examples/GettingStarted/NShipSalesPage.aspx";
            bar.InteractivityStyles[3] = interactivityStyle;
        }
コード例 #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            nChartControl1.StateManager = new NChartBatonSessionStateManager(Context, "Nevron.Examples.Chart.WebForm.NPrintingUC");
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            if (nChartControl1.RequiresInitialization)
            {
                // enable jittering (full scene antialiasing)
                nChartControl1.Settings.JitterMode = JitterMode.Enabled;

                // set a chart title
                NLabel title = nChartControl1.Labels.AddHeader("Welcome to Nevron Chart for .NET");
                title.TextStyle.BackplaneStyle.Visible = false;
                title.TextStyle.FillStyle        = new NColorFillStyle(Color.Navy);
                title.TextStyle.ShadowStyle.Type = ShadowType.GaussianBlur;
                title.ContentAlignment           = ContentAlignment.BottomRight;
                title.Location = new NPointL(
                    new NLength(2, NRelativeUnit.ParentPercentage),
                    new NLength(2, NRelativeUnit.ParentPercentage));

                // setup the legend
                NLegend legend = nChartControl1.Legends[0];
                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);

                // setup the chart
                NChart chart = nChartControl1.Charts[0];
                chart.Enable3D = true;
                chart.Axis(StandardAxis.Depth).Visible = false;
                chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
                chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalHalf);
                chart.BoundsMode = BoundsMode.Stretch;
                chart.Location   = new NPointL(
                    new NLength(10, NRelativeUnit.ParentPercentage),
                    new NLength(17, NRelativeUnit.ParentPercentage));
                chart.Size = new NSizeL(
                    new NLength(60, NRelativeUnit.ParentPercentage),
                    new NLength(73, NRelativeUnit.ParentPercentage));

                // add a bar series
                NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar);
                bar.Name                  = "Simple Bar Chart";
                bar.BarShape              = BarShape.SmoothEdgeBar;
                bar.Legend.Mode           = SeriesLegendMode.DataPoints;
                bar.DataLabelStyle.Format = "<value> <label>";

                bar.AddDataPoint(new NDataPoint(16, "Agriculture"));
                bar.AddDataPoint(new NDataPoint(42, "Construction"));
                bar.AddDataPoint(new NDataPoint(56, "Manufacturing"));
                bar.AddDataPoint(new NDataPoint(23, "Services"));
                bar.AddDataPoint(new NDataPoint(47, "Healthcare"));
                bar.AddDataPoint(new NDataPoint(38, "Finance"));

                // apply style sheet
                NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.BrightMultiColor);
                styleSheet.Apply(nChartControl1.Document);
            }
        }
コード例 #14
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;
                }
            }
        }
コード例 #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                WebExamplesUtilities.FillComboWithEnumValues(ShapeCombo, typeof(BarShape));
                ShapeCombo.SelectedIndex = 0;

                ShowDataLabelsCheck.Checked     = false;
                UseOriginCheck.Checked          = true;
                DifferentColorsCheckBox.Checked = true;
                OriginTextBox.Text = "0";
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

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

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

            NChart chart = nChartControl1.Charts[0];

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

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

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

            barSeries.Name = "Bar Series";
            barSeries.DataLabelStyle.Format             = "<value>";
            barSeries.Legend.TextStyle.FontStyle.EmSize = new NLength(8, NGraphicsUnit.Point);
            barSeries.ShadowStyle.Type       = ShadowType.GaussianBlur;
            barSeries.ShadowStyle.Offset     = new NPointL(new NLength(3, NGraphicsUnit.Pixel), new NLength(3, NGraphicsUnit.Pixel));
            barSeries.ShadowStyle.Color      = Color.FromArgb(80, 0, 0, 0);
            barSeries.ShadowStyle.FadeLength = new NLength(5, NGraphicsUnit.Pixel);

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

            UpdateFillStyles(barSeries);

            if (ShowDataLabelsCheck.Checked)
            {
                barSeries.DataLabelStyle.Visible = true;
            }
            else
            {
                barSeries.DataLabelStyle.Visible = false;
                barSeries.DataLabelStyles.Clear();
            }

            barSeries.BarShape = (BarShape)ShapeCombo.SelectedIndex;

            if (UseOriginCheck.Checked == true)
            {
                OriginTextBox.Enabled = true;
                barSeries.OriginMode  = SeriesOriginMode.CustomOrigin;

                try
                {
                    barSeries.Origin = Int32.Parse(OriginTextBox.Text);
                }
                catch
                {
                }
            }
            else
            {
                OriginTextBox.Enabled = false;
                barSeries.OriginMode  = SeriesOriginMode.MinValue;
            }

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]);
        }
コード例 #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!NThinChartControl1.Initialized)
            {
                // enable jittering (full scene antialiasing)
                NThinChartControl1.BackgroundStyle.FrameStyle.Visible = false;
                NThinChartControl1.Settings.JitterMode = JitterMode.Enabled;

                // set a chart title
                NLabel title = NThinChartControl1.Labels.AddHeader("Image Map Tools<br/>Tooltip, Browser Redirect, Cursor Change");
                title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
                title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
                title.TextStyle.TextFormat       = TextFormat.XML;

                // setup the chart
                NChart chart = NThinChartControl1.Charts[0];
                chart.Enable3D = true;
                chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
                chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1);
                chart.Axis(StandardAxis.Depth).Visible = false;

                // add a bar series
                NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar);
                bar.DataLabelStyle.Visible = false;
                bar.Legend.Mode            = SeriesLegendMode.DataPoints;
                bar.Legend.Format          = "<label> <percent>";

                bar.AddDataPoint(new NDataPoint(42, "Chart"));
                bar.AddDataPoint(new NDataPoint(56, "Diagram"));
                bar.AddDataPoint(new NDataPoint(12, "Gauges"));
                bar.AddDataPoint(new NDataPoint(23, "Maps"));

                // modify the axis labels
                NOrdinalScaleConfigurator ordinalScale = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator;
                ordinalScale.AutoLabels = false;

                for (int i = 0; i < bar.Labels.Count; i++)
                {
                    ordinalScale.Labels.Add((string)bar.Labels[i]);
                }

                // apply style sheet
                NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.PaleMultiColor);
                styleSheet.Apply(chart);

                // apply layout
                ApplyLayoutTemplate(0, NThinChartControl1, chart, title, NThinChartControl1.Legends[0]);

                // add interactivity styles with the urls to redirect to and the corresponding cursors and tooltips

                NInteractivityStyle interactivityStyle = new NInteractivityStyle("Click here to jump to Chart Gallery", CursorType.Hand);
                interactivityStyle.UrlLink.OpenInNewWindow = true;
                interactivityStyle.UrlLink.Url             = "https://www.nevron.com/products-dot-net-chart-gallery-charting-types-bar-chart.aspx";
                bar.InteractivityStyles[0] = interactivityStyle;

                interactivityStyle = new NInteractivityStyle("Click here to jump to Diagram Gallery", CursorType.Hand);
                interactivityStyle.UrlLink.OpenInNewWindow = true;
                interactivityStyle.UrlLink.Url             = "https://www.nevron.com/products-dot-net-diagram-gallery-flow-and-organization-charts-flow-charts.aspx";
                bar.InteractivityStyles[1] = interactivityStyle;

                interactivityStyle = new NInteractivityStyle("Click here to jump to Gauge Gallery", CursorType.Hand);
                interactivityStyle.UrlLink.OpenInNewWindow = true;
                interactivityStyle.UrlLink.Url             = "https://www.nevron.com/products-dot-net-chart-gallery-gauges-radial-gauge.aspx";
                bar.InteractivityStyles[2] = interactivityStyle;

                interactivityStyle = new NInteractivityStyle("Click here to jump to Maps Gallery", CursorType.Hand);
                interactivityStyle.UrlLink.OpenInNewWindow = true;
                interactivityStyle.UrlLink.Url             = "https://www.nevron.com/products-dot-net-diagram-gallery-maps-general-maps.aspx";
                bar.InteractivityStyles[3] = interactivityStyle;
                NThinChartControl1.Controller.SetActivePanel(chart);
            }

            NThinChartControl1.Controller.Tools.Clear();

            if (EnableBrowserRedirectCheckBox.Checked)
            {
                NThinChartControl1.Controller.Tools.Add(new NBrowserRedirectTool());
            }

            if (EnableTooltipsCheckBox.Checked)
            {
                NTooltipTool tooltipTool = new NTooltipTool();
                tooltipTool.FollowMouse = true;
                NThinChartControl1.Controller.Tools.Add(tooltipTool);
            }

            if (EnableCursorChangeCheckBox.Checked)
            {
                NThinChartControl1.Controller.Tools.Add(new NCursorTool());
            }

            NThinChartControl1.Controller.Tools.Add(new NTrackballTool());
        }
コード例 #17
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
                NThinChartControl1.BackgroundStyle.FrameStyle.Visible = false;

                // set a chart title
                NLabel title = new NLabel();
                NThinChartControl1.Panels.Add(title);
                title.DockMode             = PanelDockMode.Top;
                title.TextStyle.TextFormat = TextFormat.XML;
                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));

                // update the inital label text
                title.Text = "Trackball Tool<br/><font size='10pt'> Rotation[" + chart.Projection.Rotation.ToString() + "], Elevation [" + chart.Projection.Elevation.ToString() + "]</font>";

                // 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.FreshMultiColor);
                styleSheet.Apply(bar);

                NTrackballTool tbt = new NTrackballTool();
                tbt.Exclusive = true;
                tbt.Enabled   = true;

                tbt.TrackballCallback = new TrackballCallback();

                NThinChartControl1.Controller.SetActivePanel(chart);
                NThinChartControl1.Controller.Tools.Add(tbt);
            }
        }
コード例 #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                CaptureMouseEventDropDownList.Items.Add("OnClick");
                CaptureMouseEventDropDownList.Items.Add("OnDblClick");
                CaptureMouseEventDropDownList.Items.Add("OnMouseOut");
                CaptureMouseEventDropDownList.Items.Add("OnMouseOver");
                CaptureMouseEventDropDownList.Items.Add("OnMouseWheel");
                CaptureMouseEventDropDownList.SelectedIndex = 0;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

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

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

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

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

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

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

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

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

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

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

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

                interactivityStyle.CustomMapAreaAttribute.JScriptAttribute = customAttribute;

                bar.InteractivityStyles[i] = interactivityStyle;
            }

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

            nChartControl1.ServerSettings.BrowserResponseSettings.DefaultResponse = imageMapResponse;
        }
コード例 #19
0
        public override void Initialize(NThinChartControl control)
        {
            // enable jittering (full scene antialiasing)
            control.BackgroundStyle.FrameStyle.Visible = false;
            control.Settings.JitterMode = JitterMode.Enabled;

            // set a chart title
            NLabel title = control.Labels.AddHeader("Interactivity Tools<br/>Tooltip, Browser Redirect, Cursor Change");

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

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

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

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

            bar.DataLabelStyle.Visible = false;
            bar.Legend.Mode            = SeriesLegendMode.DataPoints;
            bar.Legend.Format          = "<label> <percent>";

            bar.AddDataPoint(new NDataPoint(42, "Chart"));
            bar.AddDataPoint(new NDataPoint(56, "Diagram"));
            bar.AddDataPoint(new NDataPoint(12, "Gauges"));
            bar.AddDataPoint(new NDataPoint(23, "Maps"));

            // modify the axis labels
            NOrdinalScaleConfigurator ordinalScale = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator;

            ordinalScale.AutoLabels = false;

            for (int i = 0; i < bar.Labels.Count; i++)
            {
                ordinalScale.Labels.Add((string)bar.Labels[i]);
            }

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

            styleSheet.Apply(chart);

            // apply layout
            ApplyLayoutTemplate(0, control, chart, title, control.Legends[0]);

            // add interactivity styles with the urls to redirect to and the corresponding cursors and tooltips

            NInteractivityStyle interactivityStyle = new NInteractivityStyle("Click here to jump to Chart Gallery", CursorType.Hand);

            interactivityStyle.UrlLink.OpenInNewWindow = true;
            interactivityStyle.UrlLink.Url             = "http://www.nevron.com/Gallery.ChartFor.NET.ChartTypes.BarChartGallery.aspx";
            bar.InteractivityStyles[0] = interactivityStyle;

            interactivityStyle = new NInteractivityStyle("Click here to jump to Diagram Gallery", CursorType.Hand);
            interactivityStyle.UrlLink.OpenInNewWindow = true;
            interactivityStyle.UrlLink.Url             = "http://www.nevron.com/Gallery.DiagramFor.NET.FlowAndOrganizationCharts.Flowcharts.aspx";
            bar.InteractivityStyles[1] = interactivityStyle;

            interactivityStyle = new NInteractivityStyle("Click here to jump to Gauge Gallery", CursorType.Hand);
            interactivityStyle.UrlLink.OpenInNewWindow = true;
            interactivityStyle.UrlLink.Url             = "http://www.nevron.com/Gallery.ChartFor.NET.Gauges.RadialGaugeGallery.aspx";
            bar.InteractivityStyles[2] = interactivityStyle;

            interactivityStyle = new NInteractivityStyle("Click here to jump to Maps Gallery", CursorType.Hand);
            interactivityStyle.UrlLink.OpenInNewWindow = true;
            interactivityStyle.UrlLink.Url             = "http://www.nevron.com/Gallery.DiagramFor.NET.Maps.MapProjections.aspx";
            bar.InteractivityStyles[3] = interactivityStyle;

            control.Controller.Tools.Add(new NTooltipTool());
            control.Controller.Tools.Add(new NBrowserRedirectTool());
            control.Controller.Tools.Add(new NCursorTool());

            control.Controller.Tools.Clear();

            // add browser redirect tool
            control.Controller.Tools.Add(new NBrowserRedirectTool());

            // add tooltip tool that follows the mouse
            NTooltipTool tooltipTool = new NTooltipTool();

            tooltipTool.FollowMouse = true;
            control.Controller.Tools.Add(tooltipTool);

            // add a cursor change tool
            control.Controller.Tools.Add(new NCursorTool());
        }
コード例 #20
0
        private void InitChartAndLegend()
        {
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Legend Position");

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

            // there is one legend by default when the chart is initialized
            m_Legend = (NLegend)nChartControl1.Legends[0];

            // switch the legend to manual mode
            m_Legend.Data.ExpandMode = LegendExpandMode.RowsFixed;
            m_Legend.Data.RowCount   = 4;

            m_Legend.Header.Text        = "EU Parliament Election";
            m_Legend.Footer.Text        = "Number of seats for 2004";
            m_Legend.ShadowStyle.Offset = new NPointL(3, 3);

            // now configure the chart to display some information
            NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];

            chart.Enable3D = true;
            chart.Axis(StandardAxis.Depth).Visible    = false;
            chart.Axis(StandardAxis.PrimaryX).Visible = false;

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

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

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

            bar.Name = "Bar Series";
            bar.DataLabelStyle.Visible = true;
            bar.Legend.Mode            = SeriesLegendMode.DataPoints;

            bar.AddDataPoint(new NDataPoint(39, "EUL"));
            bar.AddDataPoint(new NDataPoint(200, "PES"));
            bar.AddDataPoint(new NDataPoint(42, "EFA"));
            bar.AddDataPoint(new NDataPoint(15, "EDD"));
            bar.AddDataPoint(new NDataPoint(67, "ELDR"));
            bar.AddDataPoint(new NDataPoint(276, "EPP"));
            bar.AddDataPoint(new NDataPoint(27, "UEN"));
            bar.AddDataPoint(new NDataPoint(66, "Other"));

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

            styleSheet.Apply(nChartControl1.Document);
        }
コード例 #21
0
        public override void Initialize()
        {
            base.Initialize();

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

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

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

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

            // add interlaced stripe to the Y axis
            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;
            ((NStandardScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator).StripStyles.Add(stripStyle);

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

            bar.FillStyle              = new NGradientFillStyle(Color.LightGray, Color.SlateBlue);
            bar.ShadowStyle.Type       = ShadowType.LinearBlur;
            bar.ShadowStyle.Offset     = new NPointL(3, 3);
            bar.ShadowStyle.Color      = Color.FromArgb(40, 0, 0, 0);
            bar.ShadowStyle.FadeLength = new NLength(2);

            bar.AddDataPoint(new NDataPoint(10, "Item 0"));
            bar.AddDataPoint(new NDataPoint(20, "Item 1"));
            bar.AddDataPoint(new NDataPoint(30, "Item 2"));
            bar.AddDataPoint(new NDataPoint(25, "Item 3"));
            bar.AddDataPoint(new NDataPoint(29, "Item 4"));
            bar.AddDataPoint(new NDataPoint(27, "Item 5"));

            // 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.Format = "Individual";
            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;

            // init form controls
            FormatCombo.Items.Add("<value> <label>");
            FormatCombo.Items.Add("<index> <cumulative>");
            FormatCombo.Items.Add("<percent> <total>");

            VertAlignCombo.Items.Add("Center");
            VertAlignCombo.Items.Add("Top");
            VertAlignCombo.Items.Add("Bottom");

            DataLabelModeCombo.Items.Add("Edit Default Label");
            DataLabelModeCombo.Items.Add("Edit Data Label #3");
            DataLabelModeCombo.SelectedIndex = 0;

            // apply layout
            ConfigureStandardLayout(chart, title, null);
        }
コード例 #22
0
        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()));
        }
コード例 #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
            nChartControl1.Settings.JitterMode = JitterMode.Enabled;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            this.nChartControl1.Click += new EventHandler(this.NChartControl1_Click);
        }
コード例 #24
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;
        }