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

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

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

            // configure the chart
            m_Chart = nChartControl1.Charts[0];
            m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalHalf);
            m_Chart.Axis(StandardAxis.Depth).Visible = false;

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

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

            // setup a area series
            m_Area = new NAreaSeries();
            m_Area.InflateMargins         = true;
            m_Area.DataLabelStyle.Visible = false;
            m_Area.BorderStyle.Width      = new NLength(0);
            m_Area.Legend.Mode            = SeriesLegendMode.None;

            NPalette palette = new NPalette();

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

            m_Area.Palette = palette;

            m_AxisRange = new NRange1DD(0, 130);

            // limit the axis range to 0, 130
            yAxis.View = new NRangeAxisView(m_AxisRange, true, true);
            m_Chart.Series.Add(m_Area);

            int indicatorCount = 10;

            m_IndicatorPhase = new double[indicatorCount];

            // add some data to the area series
            for (int i = 0; i < indicatorCount; i++)
            {
                m_IndicatorPhase[i] = i * 30;
                m_Area.Values.Add(0);
            }

            SmoothPaletteCheckBox.Checked = true;

            timer1.Start();
        }
コード例 #2
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Bubble Palette");

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

            // configure the chart
            m_Chart = nChartControl1.Charts[0];
            m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal);
            m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
            m_Chart.Axis(StandardAxis.Depth).Visible = false;

            NLinearScaleConfigurator linearScale = m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;

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

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

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

            NOrdinalScaleConfigurator ordinalScale = m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;

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

            // add a bubble series
            m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble);
            m_Bubble.DataLabelStyle.VertAlign = VertAlign.Center;
            m_Bubble.DataLabelStyle.Visible   = false;
            m_Bubble.Legend.Mode   = SeriesLegendMode.DataPoints;
            m_Bubble.Legend.Format = "Size <size>, Value <value>";
            m_Bubble.MinSize       = new NLength(7.0f, NRelativeUnit.ParentPercentage);
            m_Bubble.MaxSize       = new NLength(16.0f, NRelativeUnit.ParentPercentage);

            for (int i = 0; i < 10; i++)
            {
                m_Bubble.Values.Add(i);
                m_Bubble.Sizes.Add(i * 10 + 10);
            }

            m_Bubble.InflateMargins = true;

            NPalette palette = new NPalette();

            palette.SmoothPalette = true;
            palette.Clear();
            palette.Add(0, Color.Green);
            palette.Add(60, Color.Yellow);
            palette.Add(120, Color.Red);

            m_Bubble.Palette = palette;

            // apply layout
            ConfigureStandardLayout(m_Chart, title, nChartControl1.Legends[0]);
        }
コード例 #3
0
        private void ColorFillModeComboBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            switch (ColorFillModeComboBox.SelectedIndex)
            {
            case 0:
            {
                // custom color filling -> assign colors to each group (child nodes will inherit that fill)
                NChartPalette palette = new NChartPalette(ChartPredefinedPalette.Bright);

                int industryIndex = 0;
                foreach (NGroupTreeMapNode industryTreeMapNode in m_TreeMap.RootTreeMapNode.ChildNodes)
                {
                    foreach (NTreeMapNode companyTreeMapNode in industryTreeMapNode.ChildNodes)
                    {
                        companyTreeMapNode.FillStyle = new NColorFillStyle(palette.SeriesColors[(industryIndex) % palette.SeriesColors.Count]);
                    }

                    industryIndex++;
                }
            }
            break;

            case 1:
            {
                // palette filling -> remove all fill styles assigned to nodes
                foreach (NGroupTreeMapNode industryTreeMapNode in m_TreeMap.RootTreeMapNode.ChildNodes)
                {
                    industryTreeMapNode.Palette = null;

                    foreach (NTreeMapNode companyTreeMapNode in industryTreeMapNode.ChildNodes)
                    {
                        companyTreeMapNode.FillStyle = null;
                    }
                }
            }
            break;

            case 2:
            {
                // palette filling -> remove all fill styles assigned to nodes
                foreach (NGroupTreeMapNode industryTreeMapNode in m_TreeMap.RootTreeMapNode.ChildNodes)
                {
                    NPalette palette = new NPalette();
                    palette.Mode = PaletteMode.AutoMinMaxColor;
                    industryTreeMapNode.Palette = palette;

                    foreach (NTreeMapNode companyTreeMapNode in industryTreeMapNode.ChildNodes)
                    {
                        companyTreeMapNode.FillStyle = null;
                    }
                }
            }
            break;
            }

            nChartControl1.Refresh();
        }
コード例 #4
0
        private void Palette_PaletteChanged(NPalette Palette, PaletteChangeEventArgs e)
        {
            m_CommandBarsManager.BeginUpdate();

            bool fade = Palette.Scheme == ColorScheme.Standard;

            SetFadeImageAndImageShadow(m_CommandBarsManager.CommandManager.GetAllCommands(false), fade, fade);

            NUIManager.ApplyPalette(this, Palette);
            m_CommandBarsManager.Palette.Copy(Palette);

            m_CommandBarsManager.EndUpdate(true);
        }
コード例 #5
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            NPalette pall = NUIManager.Palette;

            nCommandBarsManager1.Palette.Copy(pall);
            ApplyPalette(pall);

            InitCommandBars();

            m_iLockUpdate--;
        }
コード例 #6
0
        public override void Initialize()
        {
            base.Initialize();

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

            // set a chart title
            NLabel header = new NLabel("Legend Custom Items");

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

            NDockPanel container = new NDockPanel();

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

            // configure the legend
            NLegend legend = CreateLegend(container, "Legend Palette Item");

            NPalette palette = new NPalette();

            palette.Mode = PaletteMode.AutoFixedEntryCount;
            //palette.SmoothPalette = true;

            m_PaletteCellData = new NLegendPaletteCellData(palette, new NRange1DD(0, 100));

            legend.Data.Items.Add(m_PaletteCellData);

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

            styleSheet.Apply(nChartControl1.Document);

            OrientationComboBox.Items.Add("Horizontal");
            OrientationComboBox.Items.Add("Vertical");
            OrientationComboBox.SelectedIndex = 0;

            ScalePositionComboBox.Items.Add("Left");
            ScalePositionComboBox.Items.Add("Right");
            ScalePositionComboBox.SelectedIndex = 0;
        }
コード例 #7
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("High Low Palette");

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

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

            // add a High-Low series
            m_HighLow                        = (NHighLowSeries)m_Chart.Series.Add(SeriesType.HighLow);
            m_HighLow.Legend.Mode            = SeriesLegendMode.None;
            m_HighLow.DataLabelStyle.Visible = false;

            GenerateData();

            NPalette palette = new NPalette();

            palette.Clear();
            palette.SmoothPalette = true;
            palette.Mode          = PaletteMode.Custom;
            palette.Add(0, Color.Green);
            palette.Add(1.5, Color.Yellow);
            palette.Add(3, Color.Red);

            m_HighLow.Palette = palette;

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

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

            styleSheet.Apply(nChartControl1.Document);

            SmoothPaletteCheckBox.IsChecked = true;
            Enable3DCheckBox.IsChecked      = true;
        }
コード例 #8
0
        void nChartControl1_MouseClick(object sender, MouseEventArgs e)
        {
            NHitTestResult result = nChartControl1.HitTest(e.X, e.Y);

            if (result.ChartElement == ChartElement.TreeMapNode)
            {
                NGroupTreeMapNode groupNode = result.GroupTreeMapNode;

                if (groupNode != null && groupNode.ParentNode != null)
                {
                    m_TreeMap.RootTreeMapNode = (NGroupTreeMapNode)groupNode.Clone();

                    // assign palette to this node
                    NPalette palette = new NPalette();

                    palette.Mode                      = PaletteMode.AutoMinMaxColor;
                    palette.SmoothPalette             = true;
                    m_TreeMap.RootTreeMapNode.Palette = palette;

                    nChartControl1.Refresh();
                }
            }
        }
コード例 #9
0
        public override void Initialize()
        {
            base.Initialize();

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("High Low Palette");

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

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

            // add a High-Low series
            m_HighLow                        = (NHighLowSeries)m_Chart.Series.Add(SeriesType.HighLow);
            m_HighLow.Legend.Mode            = SeriesLegendMode.None;
            m_HighLow.DataLabelStyle.Visible = false;

            GenerateData();

            NPalette palette = new NPalette();

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

            m_HighLow.Palette = palette;

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

            SmoothPaletteCheckBox.Checked = true;
            Enable3DCheckBox.Checked      = true;
        }
コード例 #10
0
        public override void Initialize()
        {
            base.Initialize();

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

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

            // configure the chart
            m_Chart = nChartControl1.Charts[0];
            m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal);
            m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
            m_Chart.Axis(StandardAxis.Depth).Visible = false;

            NLinearScaleConfigurator linearScale = m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;

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

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

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

            NOrdinalScaleConfigurator ordinalScale = m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;

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

            // add a bubble series
            m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble);
            m_Bubble.DataLabelStyle.VertAlign = VertAlign.Center;
            m_Bubble.DataLabelStyle.Visible   = false;
            m_Bubble.MinSize = new NLength(7.0f, NRelativeUnit.ParentPercentage);
            m_Bubble.MaxSize = new NLength(16.0f, NRelativeUnit.ParentPercentage);

            for (int i = 0; i < 10; i++)
            {
                m_Bubble.Values.Add(i);
                m_Bubble.Sizes.Add(i * 10 + 10);
            }
            m_Bubble.InflateMargins = true;

            NPalette palette = new NPalette();

            palette.SmoothPalette = true;
            palette.Clear();
            palette.Add(0, Color.Green);
            palette.Add(60, Color.Yellow);
            palette.Add(120, Color.Red);

            m_Bubble.Palette = palette;

            nChartControl1.Legends[0].Header.Text = "Bubble Size";

            m_Bubble.Legend.Mode = SeriesLegendMode.SeriesLogic;
            m_Bubble.BubbleSizeScale.TextOffset = new NLength(0);
            m_Bubble.BubbleSizeScale.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Center;
            m_Bubble.BubbleSizeScale.Mode = BubbleSizeScaleMode.ConcentricDown;

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

            BubbleScaleModeCombo.FillFromEnum(typeof(BubbleSizeScaleMode));
            BubbleScaleModeCombo.SelectedIndex = (int)m_Bubble.BubbleSizeScale.Mode;
            TextOffsetNumericUpDown.Value      = (decimal)m_Bubble.BubbleSizeScale.TextOffset.Value;
            TableCellOffsetNumericUpDown.Value = (decimal)m_Bubble.BubbleSizeScale.TableCellOffset.Value;
            BubbleScaleStepsUpDown.Value       = (decimal)m_Bubble.BubbleSizeScale.Steps;
            RoundValuesCheckBox.Checked        = m_Bubble.BubbleSizeScale.RoundValues;

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

            // Enable GPU acceleration
            nChartControl1.Settings.RenderSurface = RenderSurface.Window;

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

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

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

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

            chart.Enable3D = true;
            chart.Width    = 55.0f;
            chart.Depth    = 55.0f;
            chart.Height   = 45.0f;
            chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyCameraLight);

            SetupAxisAnchorsAndWalls(chart);

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

            scaleY.RoundToTickMax = false;
            NAxis axisY = chart.Axis(StandardAxis.PrimaryY);

            axisY.View = new NRangeAxisView(new NRange1DD(0, 100), true, false);
            axisY.ScaleConfigurator = scaleY;

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

            scaleX.RoundToTickMin = false;
            scaleX.RoundToTickMax = false;
            NAxis axisX = chart.Axis(StandardAxis.PrimaryX);

            axisX.ScaleConfigurator = scaleX;

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

            scaleZ.MajorGridStyle.ShowAtWalls = new ChartWallType[0];
            scaleZ.RoundToTickMin             = false;
            scaleZ.RoundToTickMax             = false;
            NAxis axisZ = chart.Axis(StandardAxis.Depth);

            axisZ.ScaleConfigurator = scaleZ;

            // add a surface series
            NGridSurfaceSeries surface = new NGridSurfaceSeries();

            chart.Series.Add(surface);
            surface.Name        = "Surface";
            surface.Legend.Mode = SeriesLegendMode.None;
            surface.FillStyle   = new NColorFillStyle(Color.FromArgb(160, 170, 212));
            surface.FillMode    = SurfaceFillMode.Uniform;
            surface.FrameMode   = SurfaceFrameMode.None;
            surface.DrawFlat    = false;
            surface.ShadingMode = ShadingMode.Smooth;
            SetupCommonSurfaceProperties(surface);

            // fill both surfaces with the same data
            FillData(surface);

            // add a surface series
            NGridSurfaceSeries contour = new NGridSurfaceSeries();

            chart.Series.Add(contour);
            contour.Name        = "Contour";
            contour.Legend.Mode = SeriesLegendMode.SeriesLogic;
            contour.FillMode    = SurfaceFillMode.Zone;
            contour.FrameMode   = SurfaceFrameMode.Contour;
            contour.DrawFlat    = true;
            contour.ShadingMode = ShadingMode.Flat;
            SetupCommonSurfaceProperties(contour);

            // fill both surfaces with the same data
            FillData(contour);

            NPalette palette = contour.Palette;

            palette.Mode = PaletteMode.Custom;

            contour.AutomaticPalette = false;
            contour.Palette.Clear();
            contour.Palette.Add(250, Color.FromArgb(112, 211, 162));
            contour.Palette.Add(311, Color.FromArgb(113, 197, 212));
            contour.Palette.Add(328, Color.FromArgb(114, 162, 212));
            contour.Palette.Add(344, Color.FromArgb(196, 185, 206));
            contour.Palette.Add(358, Color.FromArgb(161, 130, 191));
            contour.Palette.Add(370, Color.FromArgb(198, 170, 165));
            contour.Palette.Add(400, Color.FromArgb(255, 0, 0));

            contour.Palette.Add(0, Color.Red);
            contour.Palette.Add(100, Color.Blue);

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

            UseHardwareAccelerationCheckBox.Checked = true;
        }
コード例 #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

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

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

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

            chart.Enable3D = false;

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

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

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

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

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

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

            // add a bubble series
            NBubbleSeries bubble = (NBubbleSeries)chart.Series.Add(SeriesType.Bubble);

            bubble.DataLabelStyle.VertAlign = VertAlign.Center;
            bubble.DataLabelStyle.Visible   = false;
            bubble.Legend.Mode   = SeriesLegendMode.DataPoints;
            bubble.Legend.Format = "<size>";
            bubble.MinSize       = new NLength(7.0f, NRelativeUnit.ParentPercentage);
            bubble.MaxSize       = new NLength(16.0f, NRelativeUnit.ParentPercentage);

            for (int i = 0; i < 10; i++)
            {
                bubble.Values.Add(i);
                bubble.Sizes.Add(i * 10 + 10);
            }

            bubble.InflateMargins = true;

            NPalette palette = new NPalette();

            palette.SmoothPalette = true;
            palette.Clear();
            palette.Add(0, Color.Green);
            palette.Add(60, Color.Yellow);
            palette.Add(120, Color.Red);

            bubble.Palette = palette;

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]);
        }
コード例 #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SmoothPaletteCheckBox.Checked = true;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            nChartControl1.Legends[0].Visible = false;

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

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

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

            chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalHalf);
            chart.Axis(StandardAxis.Depth).Visible = false;

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

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

            // add a High-Low series
            NHighLowSeries highLow = (NHighLowSeries)chart.Series.Add(SeriesType.HighLow);

            highLow.Legend.Mode            = SeriesLegendMode.None;
            highLow.DataLabelStyle.Visible = false;

            highLow.ClearDataPoints();

            for (int i = 0; i < 20; i++)
            {
                double d1 = Math.Log(i + 1) + 0.1 * Random.NextDouble();
                double d2 = d1 + Math.Cos(0.33 * i) + 0.1 * Random.NextDouble();

                highLow.HighValues.Add(d1);
                highLow.LowValues.Add(d2);
            }

            NPalette palette = new NPalette();

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

            highLow.Palette = palette;

            highLow.Palette.SmoothPalette = SmoothPaletteCheckBox.Checked;

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]);
        }
コード例 #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                WebExamplesUtilities.FillComboWithEnumNames(VerticalFillModeDropDownList, typeof(TreeMapVerticalFillMode));
                VerticalFillModeDropDownList.SelectedIndex = (int)TreeMapVerticalFillMode.Default;

                WebExamplesUtilities.FillComboWithEnumNames(HorizontalFillModeDropDownList, typeof(TreeMapHorizontalFillMode));
                HorizontalFillModeDropDownList.SelectedIndex = (int)TreeMapVerticalFillMode.Default;

                ColorModeDropDownList.Items.Add("Custom");
                ColorModeDropDownList.Items.Add("Common Palette");
                ColorModeDropDownList.Items.Add("Group Palette");
                ColorModeDropDownList.SelectedIndex = 1;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;


            // set a chart title
            NLabel title = new NLabel("Tree Map");

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

            NTreeMapChart treeMap = new NTreeMapChart();

            nChartControl1.Panels.Add(treeMap);
            treeMap.DockMode = PanelDockMode.Fill;

            XmlDocument document = LoadData();

            foreach (XmlElement industry in document.DocumentElement)
            {
                NGroupTreeMapNode treeMapSeries = new NGroupTreeMapNode();

                treeMapSeries.StrokeStyle = new NStrokeStyle(4, Color.Black);
                treeMapSeries.Padding     = new NMarginsL(2.0f);

                treeMap.RootTreeMapNode.ChildNodes.Add(treeMapSeries);

                treeMapSeries.Label = industry.Attributes["Name"].Value;
                treeMapSeries.InteractivityStyle = new NInteractivityStyle(treeMapSeries.Label);

                foreach (XmlElement company in industry.ChildNodes)
                {
                    double value  = double.Parse(company.Attributes["Size"].Value);
                    double change = double.Parse(company.Attributes["Change"].Value);
                    string label  = company.Attributes["Name"].Value;

                    NValueTreeMapNode node = new NValueTreeMapNode(value, change, label);
                    node.InteractivityStyle = new NInteractivityStyle(label);
                    //						node.FillStyle = new NColorFillStyle(Color.Green);
                    treeMapSeries.ChildNodes.Add(node);
                }
            }

            nChartControl1.Controller.Tools.Add(new NTooltipTool());

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

            // update from from controls
            treeMap.RootTreeMapNode.HorizontalFillMode = (TreeMapHorizontalFillMode)HorizontalFillModeDropDownList.SelectedIndex;
            treeMap.RootTreeMapNode.VerticalFillMode   = (TreeMapVerticalFillMode)VerticalFillModeDropDownList.SelectedIndex;

            switch (ColorModeDropDownList.SelectedIndex)
            {
            case 0:
            {
                // custom color filling -> assign colors to each group (child nodes will inherit that fill)
                NChartPalette palette = new NChartPalette(ChartPredefinedPalette.Bright);

                int industryIndex = 0;
                foreach (NGroupTreeMapNode industryTreeMapNode in treeMap.RootTreeMapNode.ChildNodes)
                {
                    foreach (NTreeMapNode companyTreeMapNode in industryTreeMapNode.ChildNodes)
                    {
                        companyTreeMapNode.FillStyle = new NColorFillStyle(palette.SeriesColors[(industryIndex) % palette.SeriesColors.Count]);
                    }

                    industryIndex++;
                }
            }
            break;

            case 1:
            {
                // palette filling -> remove all fill styles assigned to nodes
                foreach (NGroupTreeMapNode industryTreeMapNode in treeMap.RootTreeMapNode.ChildNodes)
                {
                    industryTreeMapNode.Palette = null;

                    foreach (NTreeMapNode companyTreeMapNode in industryTreeMapNode.ChildNodes)
                    {
                        companyTreeMapNode.FillStyle = null;
                    }
                }
            }
            break;

            case 2:
            {
                // palette filling -> remove all fill styles assigned to nodes
                foreach (NGroupTreeMapNode industryTreeMapNode in treeMap.RootTreeMapNode.ChildNodes)
                {
                    NPalette palette = new NPalette();
                    palette.Mode = PaletteMode.AutoMinMaxColor;
                    industryTreeMapNode.Palette = palette;

                    foreach (NTreeMapNode companyTreeMapNode in industryTreeMapNode.ChildNodes)
                    {
                        companyTreeMapNode.FillStyle = null;
                    }
                }
            }
            break;
            }
        }
コード例 #15
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Bar Palette");

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

            // configure the chart
            m_Chart = nChartControl1.Charts[0];
            m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalHalf);
            m_Chart.Axis(StandardAxis.Depth).Visible = false;

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

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

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

            NPalette palette = new NPalette();

            palette.SmoothPalette = true;
            palette.Clear();
            palette.Add(0, Color.Green);
            palette.Add(60, Color.Yellow);
            palette.Add(120, Color.Red);

            m_Bar.Palette = palette;

            m_AxisRange = new NRange1DD(0, 130);

            // limit the axis range to 0, 130
            yAxis.View = new NRangeAxisView(m_AxisRange, true, true);
            m_Chart.Series.Add(m_Bar);

            int indicatorCount = 10;

            m_IndicatorPhase = new double[indicatorCount];

            // add some data to the bar series
            for (int i = 0; i < indicatorCount; i++)
            {
                m_IndicatorPhase[i] = i * 30;
                m_Bar.Values.Add(0);
            }

            NExampleHelpers.FillComboWithEnumValues(BarPaletteModeComboBox, typeof(PaletteColorMode));
            BarPaletteModeComboBox.SelectedIndex = (int)PaletteColorMode.Spread;
            SmoothPaletteCheckBox.IsChecked      = true;

            m_Timer          = new System.Windows.Threading.DispatcherTimer();
            m_Timer.Tick    += new EventHandler(OnTimerTick);
            m_Timer.Interval = new TimeSpan(0, 0, 0, 0, 50);
            m_Timer.Start();
        }
コード例 #16
0
        public override void Create()
        {
            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel header = new NLabel("Gauge Indicator Palette");

            header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);
            header.ContentAlignment    = ContentAlignment.BottomRight;
            header.Location            = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));

            nChartControl1.Panels.Add(header);

            // create the radial gauge
            NRadialGaugePanel m_RadialGauge = new NRadialGaugePanel();

            m_RadialGauge.PaintEffect         = new NGlassEffectStyle();
            m_RadialGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.Auto);
            m_RadialGauge.ContentAlignment    = ContentAlignment.MiddleCenter;
            m_RadialGauge.Location            = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(55, NRelativeUnit.ParentPercentage));
            m_RadialGauge.Size                = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage));
            m_RadialGauge.BackgroundFillStyle = new NGradientFillStyle(Color.DarkGray, Color.Black);

            // configure scale
            NGaugeAxis axis = (NGaugeAxis)m_RadialGauge.Axes[0];
            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Presentation);
            scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 12, System.Drawing.FontStyle.Bold);
            scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White);
            scale.LabelStyle.Angle             = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0);
            scale.MinorTickCount               = 4;
            scale.RulerStyle.BorderStyle.Width = new NLength(0);
            scale.RulerStyle.FillStyle         = new NColorFillStyle(Color.DarkGray);

            // add radial gauge indicators
            m_RangeIndicator                   = new NRangeIndicator();
            m_RangeIndicator.Value             = 20;
            m_RangeIndicator.FillStyle         = new NGradientFillStyle(Color.Yellow, Color.Red);
            m_RangeIndicator.StrokeStyle.Color = Color.DarkBlue;
            m_RangeIndicator.EndWidth          = new NLength(20);
            m_RadialGauge.Indicators.Add(m_RangeIndicator);

            m_NeedleIndicator                         = new NNeedleValueIndicator();
            m_NeedleIndicator.Value                   = 79;
            m_NeedleIndicator.Shape.FillStyle         = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red);
            m_NeedleIndicator.Shape.StrokeStyle.Color = Color.Red;
            m_RadialGauge.Indicators.Add(m_NeedleIndicator);
            m_RadialGauge.SweepAngle = 270;

            // add radial gauge
            nChartControl1.Panels.Add(m_RadialGauge);

            m_Palette = new NPalette();
            m_Palette.SmoothPalette = true;
            m_Palette.PositiveColor = Color.Green;
            m_Palette.NegativeColor = Color.Red;

            m_NeedleIndicator.Palette         = (NPalette)m_Palette.Clone();
            m_RangeIndicator.Palette          = (NPalette)m_Palette.Clone();
            m_RangeIndicator.PaletteColorMode = PaletteColorMode.Spread;

            NExampleHelpers.FillComboWithEnumValues(PaletteSpreadModeComboBox, typeof(PaletteColorMode));
            PaletteSpreadModeComboBox.SelectedIndex = (int)PaletteColorMode.Spread;

            EnableIndicatorPaletteCheckBox.IsChecked = true;
            IndicatorsValueScrollBar.Value           = m_NeedleIndicator.Value;
        }
コード例 #17
0
        public override void Initialize()
        {
            base.Initialize();

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

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

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

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

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

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

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

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

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

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

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

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

            NPalette palette = new NPalette();

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

            m_SmoothArea.Palette = palette;

            GenerateYValues(nValuesCount);
            GenerateXValues(nValuesCount);

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

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

            styleSheet.Apply(nChartControl1.Document);
            SmoothPaletteCheckBox.Checked = true;
            Enable3DCheckBox.Checked      = true;
        }
コード例 #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SmoothPaletteCheckBox.Checked = true;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            nChartControl1.Legends[0].Visible = false;

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

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

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

            chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalHalf);
            chart.Axis(StandardAxis.Depth).Visible = false;

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

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

            // create the float bar series
            NFloatBarSeries floatBar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar);

            floatBar.DataLabelStyle.Visible   = false;
            floatBar.DataLabelStyle.VertAlign = VertAlign.Center;
            floatBar.DataLabelStyle.Format    = "<begin> - <end>";

            // add bars
            floatBar.AddDataPoint(new NFloatBarDataPoint(2, 10));
            floatBar.AddDataPoint(new NFloatBarDataPoint(5, 16));
            floatBar.AddDataPoint(new NFloatBarDataPoint(9, 17));
            floatBar.AddDataPoint(new NFloatBarDataPoint(12, 21));
            floatBar.AddDataPoint(new NFloatBarDataPoint(8, 18));
            floatBar.AddDataPoint(new NFloatBarDataPoint(7, 18));
            floatBar.AddDataPoint(new NFloatBarDataPoint(3, 11));
            floatBar.AddDataPoint(new NFloatBarDataPoint(5, 12));
            floatBar.AddDataPoint(new NFloatBarDataPoint(8, 17));
            floatBar.AddDataPoint(new NFloatBarDataPoint(6, 15));
            floatBar.AddDataPoint(new NFloatBarDataPoint(3, 10));
            floatBar.AddDataPoint(new NFloatBarDataPoint(1, 7));

            NPalette palette = new NPalette();

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

            floatBar.Palette = palette;

            floatBar.Palette.SmoothPalette = SmoothPaletteCheckBox.Checked;

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]);
        }
コード例 #19
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Float Bar Palette");

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

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

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

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

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

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

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

            // create the float bar series
            m_FloatBar = (NFloatBarSeries)m_Chart.Series.Add(SeriesType.FloatBar);
            m_FloatBar.DataLabelStyle.Visible   = false;
            m_FloatBar.DataLabelStyle.VertAlign = VertAlign.Center;
            m_FloatBar.DataLabelStyle.Format    = "<begin> - <end>";

            // add bars
            m_FloatBar.AddDataPoint(new NFloatBarDataPoint(2, 10));
            m_FloatBar.AddDataPoint(new NFloatBarDataPoint(5, 16));
            m_FloatBar.AddDataPoint(new NFloatBarDataPoint(9, 17));
            m_FloatBar.AddDataPoint(new NFloatBarDataPoint(12, 21));
            m_FloatBar.AddDataPoint(new NFloatBarDataPoint(8, 18));
            m_FloatBar.AddDataPoint(new NFloatBarDataPoint(7, 18));
            m_FloatBar.AddDataPoint(new NFloatBarDataPoint(3, 11));
            m_FloatBar.AddDataPoint(new NFloatBarDataPoint(5, 12));
            m_FloatBar.AddDataPoint(new NFloatBarDataPoint(8, 17));
            m_FloatBar.AddDataPoint(new NFloatBarDataPoint(6, 15));
            m_FloatBar.AddDataPoint(new NFloatBarDataPoint(3, 10));
            m_FloatBar.AddDataPoint(new NFloatBarDataPoint(1, 7));

            NPalette palette = new NPalette();

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

            m_FloatBar.Palette = palette;

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

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

            styleSheet.Apply(nChartControl1.Document);

            SmoothPaletteCheckBox.IsChecked = true;
            Enable3DCheckBox.IsChecked      = true;
        }
コード例 #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SmoothPaletteCheckBox.Checked = true;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            nChartControl1.Legends[0].Visible = false;

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

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

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

            chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalHalf);
            chart.Axis(StandardAxis.Depth).Visible = false;

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

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

            // setup a bar series
            NAreaSeries area = new NAreaSeries();

            area.Name                   = "Area Series";
            area.InflateMargins         = true;
            area.UseXValues             = false;
            area.DataLabelStyle.Visible = false;

            NPalette palette = new NPalette();

            palette.Clear();
            palette.Add(0, Color.Green);
            palette.Add(60, Color.Yellow);
            palette.Add(120, Color.Red);

            area.Palette = palette;

            chart.Series.Add(area);

            int indicatorCount = 18;

            // add some data to the bar series
            float degree2Rad = (float)(Math.PI / 180);

            for (int i = 0; i <= indicatorCount; i++)
            {
                area.Values.Add(Math.Sin(degree2Rad * i * 10) * 150.0);
            }

            area.Palette.SmoothPalette = SmoothPaletteCheckBox.Checked;

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]);
        }
コード例 #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                WebExamplesUtilities.FillComboWithEnumNames(PaletteModeDropDownList, typeof(PaletteColorMode));
                PaletteModeDropDownList.SelectedIndex = (int)PaletteColorMode.Spread;
                SmoothPaletteCheckBox.Checked         = true;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            nChartControl1.Legends[0].Visible = false;

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

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

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

            chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalHalf);
            chart.Axis(StandardAxis.Depth).Visible = false;

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

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

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

            bar.Name                   = "Bar Series";
            bar.InflateMargins         = true;
            bar.UseXValues             = false;
            bar.DataLabelStyle.Visible = false;

            NPalette palette = new NPalette();

            palette.Clear();
            palette.Add(0, Color.Green);
            palette.Add(60, Color.Yellow);
            palette.Add(120, Color.Red);

            bar.Palette = palette;

            chart.Series.Add(bar);

            int indicatorCount = 10;

            // add some data to the bar series
            for (int i = 0; i < indicatorCount; i++)
            {
                bar.Values.Add(i * 15);
            }

            bar.PaletteColorMode      = (PaletteColorMode)PaletteModeDropDownList.SelectedIndex;
            bar.Palette.SmoothPalette = SmoothPaletteCheckBox.Checked;

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