コード例 #1
0
        protected override void LoadExample()
        {
            // init form members
            highlightFillStyle   = new NColorFillStyle(Color.FromArgb(80, Color.Red));
            highlightStrokeStyle = new NStrokeStyle(2, Color.Red);

            // begin view init
            view.BeginInit();

            view.Grid.Visible   = false;
            view.Selection.Mode = DiagramSelectionMode.Single;
            view.InteractiveAppearance.SelectedStrokeStyle = new NStrokeStyle(2, Color.Blue);
            view.InteractiveAppearance.SelectedFillStyle   = new NColorFillStyle(Color.FromArgb(80, Color.Blue));

            // init document
            document.BeginInit();
            InitDocument();
            document.EndInit();

            // init form controls
            InitFormControls();

            // end view init
            view.EndInit();
        }
コード例 #2
0
        protected static void InitializeConfigurationFields(int boardCellCount)
        {
            //	initialize sizes
            imagePadding     = 10;
            imagePixelWidth  = 420;
            imagePixelHeight = 320;

            shadowOffset = 4;
            boardPadding = 10;

            //	calculate additional sizes
            boardPixelWidth  = (int)Math.Floor((double)((imagePixelWidth - imagePadding - 2 * boardPadding)));
            boardPixelHeight = (int)Math.Floor((double)((imagePixelHeight - imagePadding - 2 * boardPadding)));

            boardPixelWidth  = Math.Min(boardPixelWidth, boardPixelHeight);
            boardPixelHeight = Math.Min(boardPixelWidth, boardPixelHeight);

            cellPixelWidth  = (int)Math.Floor((double)(boardPixelWidth / boardCellCount));
            cellPixelHeight = (int)Math.Floor((double)(boardPixelHeight / boardCellCount));

            boardPixelWidth  = cellPixelWidth * boardCellCount + 2 * boardPadding;
            boardPixelHeight = cellPixelHeight * boardCellCount + 2 * boardPadding;

            boardMarginLeft = (int)Math.Floor((double)(imagePixelWidth - boardPixelWidth) / 2);
            boardMarginTop  = (int)Math.Floor((double)(imagePixelHeight - boardPixelHeight) / 2);

            //	precache styles
            emptyCellFillStyle    = new NColorFillStyle(Color.WhiteSmoke);
            completeCellFillStyle = new NColorFillStyle(Color.PeachPuff);

            hoverDeniedCellFillStyle  = new NGradientFillStyle(GradientStyle.FromCenter, GradientVariant.Variant1, Color.Navy, Color.White);
            hoverAllowedCellFillStyle = new NGradientFillStyle(GradientStyle.FromCenter, GradientVariant.Variant1, Color.LimeGreen, Color.White);

            normalCellStrokeStyle = new NStrokeStyle(new NLength(1f, NGraphicsUnit.Pixel), Color.White);
        }
コード例 #3
0
        public void OnAfterPaint(NPanel panel, NPanelPaintEventArgs eventArgs)
        {
            // draw a circle for each point
            for (int i = 0; i < m_Points.Count; i++)
            {
                MousePoint site = m_Points[i];
                Point      p    = site.Location;
                float      sz   = site.Size;

                if (sz > 0)
                {
                    NStrokeStyle strokeStyle = null;

                    if ((site.MouseButtons & MouseButtons.Left) != 0)
                    {
                        strokeStyle = m_StrokeCrimson;
                    }
                    else
                    {
                        strokeStyle = m_StrokeMediumSeaGreen;
                    }

                    if ((site.MouseButtons & MouseButtons.Right) != 0)
                    {
                        sz *= 4;
                    }

                    eventArgs.Graphics.PaintEllipse(null, strokeStyle, new NRectangleF(p.X - sz / 2, p.Y - sz / 2, sz, sz));
                }
            }
        }
コード例 #4
0
        public NFloorPlanDiagramUC(NMainForm form)
            : base(form)
        {
            initializingControls = true;

            InitializeComponent();

            //	styles
            txMain           = new NTextStyle();
            txMain.FontStyle = new NFontStyle("Arial", 9);
            txMain.BackplaneStyle.Visible = false;
            txMain.Offset = new NPointL(0, 0);

            txLine           = new NTextStyle();
            txLine.FontStyle = new NFontStyle("Arial", 9);
            txLine.BackplaneStyle.Visible   = true;
            txLine.BackplaneStyle.FillStyle = new NColorFillStyle(Color.FromArgb(128, Color.White));
            txLine.BackplaneStyle.StandardFrameStyle.Visible = false;

            txLineSmall           = new NTextStyle();
            txLineSmall.FontStyle = new NFontStyle("Arial", 5);
            txLineSmall.BackplaneStyle.Visible   = true;
            txLineSmall.BackplaneStyle.FillStyle = new NColorFillStyle(Color.FromArgb(128, Color.White));
            txLineSmall.BackplaneStyle.StandardFrameStyle.Visible = false;

            sstOdd  = new NStrokeStyle(1, Color.Black);
            sstEven = new NStrokeStyle(1, Color.LightGray);

            initializingControls = false;
        }
コード例 #5
0
            public MyCustomBezierSeries(NChart chart, NCustomSeries series)
            {
                m_Chart  = chart;
                m_Series = series;

                PointFill        = new NColorFillStyle(Color.Red);
                ControlPointFill = new NColorFillStyle(Color.DarkOliveGreen);
                BezierStroke     = new NStrokeStyle(1, Color.Indigo);
                TangentStroke    = new NStrokeStyle(1, Color.OliveDrab);
            }
コード例 #6
0
        private void Bar3Border_Click(object sender, System.EventArgs e)
        {
            NStrokeStyle strokeStyleResult;
            NStrokeStyle inStrokeStyle = (NStrokeStyle)m_Bar.BorderStyles[3];

            if (NStrokeStyleTypeEditor.Edit(inStrokeStyle, false, out strokeStyleResult))
            {
                m_Bar.BorderStyles[3] = strokeStyleResult;
                nChartControl1.Refresh();
            }
        }
コード例 #7
0
ファイル: NGridUC.cs プロジェクト: Nevron-Software/Vision
        private void minorLinesButton_Click(object sender, System.EventArgs e)
        {
            NStrokeStyle style = view.Grid.MinorLinesStrokeStyle;

            if (!NStrokeStyleTypeEditor.Edit(style, out style))
            {
                return;
            }

            view.Grid.MinorLinesStrokeStyle = style;
            view.SmartRefresh();
        }
コード例 #8
0
        private NMaster CreateGeneralizationMaster()
        {
            NStep3Connector c = new NStep3Connector(new NPointF(0, 0), new NPointF(100, 50), true);

            c.Name = "UML Generalization";

            NStrokeStyle    strokeStyle    = (NStrokeStyle)document.ComposeStrokeStyle().Clone();
            NArrowheadStyle arrowheadStyle = new NArrowheadStyle(ArrowheadShape.Arrow, string.Empty, ArrowSize, ConFillStyle, strokeStyle);

            NStyle.SetStartArrowheadStyle(c, arrowheadStyle);

            return(new NMaster(c, NGraphicsUnit.Pixel, c.Name, "Drag me on the drawing"));
        }
コード例 #9
0
        private void StrokeStyleButton_Click(object sender, EventArgs e)
        {
            NChart chart = nChartControl1.Charts[0];
            NLinearScaleConfigurator scale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;
            NScaleBreak scaleBreak         = (NScaleBreak)scale.ScaleBreaks[0];

            NStrokeStyle result = null;

            if (NStrokeStyleTypeEditor.Edit(scaleBreak.Style.StrokeStyle, out result))
            {
                scaleBreak.Style.StrokeStyle = result;
                nChartControl1.Refresh();
            }
        }
コード例 #10
0
        /// <summary>
        /// Shows the stroke style editor for the specified styleable node
        /// </summary>
        /// <param name="styleable"></param>
        protected void ShowStrokeStyleEditor(INStyleable styleable)
        {
            if (styleable == null)
            {
                return;
            }

            NStrokeStyle strokeStyle    = styleable.ComposeStrokeStyle();
            NStrokeStyle newStrokeStyle = null;

            if (NStrokeStyleTypeEditor.Edit(strokeStyle, out newStrokeStyle))
            {
                NStyle.SetStrokeStyle(styleable, newStrokeStyle);
                document.RefreshAllViews();
            }
        }
コード例 #11
0
        private NMaster CreateCompositionMaster()
        {
            NStep3Connector c = new NStep3Connector(new NPointF(0, 0), new NPointF(100, 50), true);

            c.Name = "UML Composition";

            NStrokeStyle    strokeStyle    = (NStrokeStyle)document.ComposeStrokeStyle().Clone();
            NArrowheadStyle arrowheadStyle = new NArrowheadStyle(ArrowheadShape.Losangle, string.Empty, LosangleSize, new NColorFillStyle(Color.Silver), (NStrokeStyle)strokeStyle.Clone());

            NStyle.SetStartArrowheadStyle(c, arrowheadStyle);

            arrowheadStyle = new NArrowheadStyle(ArrowheadShape.OpenedArrow, string.Empty, ArrowSize, ConFillStyle, (NStrokeStyle)strokeStyle.Clone());
            NStyle.SetEndArrowheadStyle(c, arrowheadStyle);

            return(new NMaster(c, NGraphicsUnit.Pixel, c.Name, "Drag me on the drawing"));
        }
コード例 #12
0
        private NMaster CreateAssociationMaster()
        {
            NStep3Connector c = new NStep3Connector(new NPointF(0, 0), new NPointF(100, 50), true);

            c.Name = "UML Association";

            NStrokeStyle    strokeStyle    = (NStrokeStyle)document.ComposeStrokeStyle().Clone();
            NArrowheadStyle arrowheadStyle = new NArrowheadStyle(ArrowheadShape.OpenedArrow, string.Empty, ArrowSize, ConFillStyle, (NStrokeStyle)strokeStyle.Clone());

            NStyle.SetEndArrowheadStyle(c, arrowheadStyle);

            strokeStyle.Pattern = LinePattern.Dash;
            NStyle.SetStrokeStyle(c, strokeStyle);

            return(new NMaster(c, NGraphicsUnit.Pixel, c.Name, "Drag me on the drawing"));
        }
コード例 #13
0
        private void TickStrokeStyleButton_Click(object sender, EventArgs e)
        {
            if (m_Chart == null)
            {
                return;
            }

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

            NStrokeStyle strokeStyle = null;

            if (NStrokeStyleTypeEditorNoAutomatic.Edit(scale.OuterMajorTickStyle.LineStyle, false, out strokeStyle))
            {
                scale.OuterMajorTickStyle.LineStyle = strokeStyle;
                nChartControl1.Refresh();
            }
        }
コード例 #14
0
        protected static void InitializeConfigurationFields()
        {
            //	initialize sizes
            imagePixelWidth  = 420;
            imagePixelHeight = 320;
            imagePadding     = 10;
            shadowOffset     = 5;

            cellPixelWidth  = 20;
            cellPixelHeight = 20;

            //	calculate additional sizes
            boardCellCountWidth  = (int)(Math.Floor((double)(imagePixelWidth - 2 * imagePadding) / cellPixelWidth));
            boardCellCountHeight = (int)(Math.Floor((double)(imagePixelHeight - 2 * imagePadding) / cellPixelHeight));

            boardPixelWidth  = boardCellCountWidth * cellPixelWidth;
            boardPixelHeight = boardCellCountHeight * cellPixelHeight;
            boardMarginLeft  = (int)Math.Floor((double)(imagePixelWidth - boardPixelWidth) / 2) - (int)Math.Floor((double)(shadowOffset / 2));
            boardMarginTop   = (int)Math.Floor((double)(imagePixelHeight - boardPixelHeight) / 2) - (int)Math.Floor((double)(shadowOffset / 2));

            centerCellCountX = (int)Math.Floor((double)boardCellCountWidth / 2);
            centerCellCountY = (int)Math.Floor((double)boardCellCountHeight / 2);

            //	an r-pentamino configuration
            initialConfigurationCoordinates = new int[][]
            {
                new int[] { centerCellCountX, centerCellCountY - 1 },
                new int[] { centerCellCountX + 1, centerCellCountY - 1 },
                new int[] { centerCellCountX - 1, centerCellCountY },
                new int[] { centerCellCountX, centerCellCountY },
                new int[] { centerCellCountX, centerCellCountY + 1 },
            };

            //	precache styles
            emptyCellFillStyle       = new NColorFillStyle(Color.White);
            fullCellFillStyle        = new NColorFillStyle(Color.Red);
            emptyPinnedCellFillStyle = new NColorFillStyle(Color.LightGray);
            fullPinnedCellFillStyle  = new NColorFillStyle(Color.Brown);

            normalCellStrokeStyle   = new NStrokeStyle(new NLength(1f, NGraphicsUnit.Pixel), Color.Black);
            highliteCellStrokeStyle = new NStrokeStyle(new NLength(2f, NGraphicsUnit.Pixel), Color.Blue);
        }
コード例 #15
0
            public override void OnAfterPaint(NPanel panel, NPanelPaintEventArgs eventArgs)
            {
                NGraphics graphics = eventArgs.Graphics;

                double     dPreviousValue, dCurrentValue;
                int        nBarCount = 10;
                NChart     chart     = panel as NChart;
                NBarSeries bar       = (NBarSeries)chart.Series[0];

                NAxis horzAxis = chart.Axis(StandardAxis.PrimaryX);
                NAxis vertAxis = chart.Axis(StandardAxis.PrimaryY);

                NVector3DF vecClientPoint = new NVector3DF();
                NVector3DF vecModelPoint  = new NVector3DF();

                int nBarSize = (int)(chart.ContentArea.Width * (int)bar.WidthPercent) / (nBarCount * 200);

                // init pens and brushes
                NStrokeStyle rectStrokeStyle = new NStrokeStyle(1, Color.DarkBlue);
                NFillStyle   rectFillStyle   = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.FromArgb(125, Color.LightBlue), Color.FromArgb(125, Color.DarkBlue));

                NLightingImageFilter lightingFilter = new NLightingImageFilter();

                NStrokeStyle positiveArrowStrokeStyle = new NStrokeStyle(1, Color.DarkGreen);
                NFillStyle   positiveArrowFillStyle   = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.Green, Color.DarkGreen);

                positiveArrowFillStyle.ImageFiltersStyle.Filters.Add(lightingFilter);

                NStrokeStyle equalSignStrokeStyle = new NStrokeStyle(1, Color.DarkGray);
                NFillStyle   equalSignFillStyle   = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.Gray, Color.DarkGray);

                positiveArrowFillStyle.ImageFiltersStyle.Filters.Add(lightingFilter);

                NStrokeStyle negativeArrowStrokeStyle = new NStrokeStyle(1, Color.DarkRed);
                NFillStyle   negativeArrowFillStyle   = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.Red, Color.DarkRed);

                positiveArrowFillStyle.ImageFiltersStyle.Filters.Add(lightingFilter);

                for (int i = 1; i < bar.Values.Count; i++)
                {
                    dPreviousValue = (double)bar.Values[i - 1];
                    dCurrentValue  = (double)bar.Values[i];

                    vecModelPoint.X = horzAxis.TransformScaleToModel(false, i);
                    vecModelPoint.Y = vertAxis.TransformScaleToModel(false, (float)(double)bar.Values[i]);
                    vecModelPoint.Z = 0;

                    if (!chart.TransformModelToClient(vecModelPoint, ref vecClientPoint))
                    {
                        continue;
                    }

                    RectangleF rcArrowRect = new RectangleF(vecClientPoint.X - nBarSize, vecClientPoint.Y - nBarSize, 2 * nBarSize, 2 * nBarSize);

                    if (rcArrowRect.Width <= 0 || rcArrowRect.Height <= 0)
                    {
                        continue;
                    }

                    if (!DisplayMark(dCurrentValue, dPreviousValue))
                    {
                        continue;
                    }

                    // draw arrow background
                    GraphicsPath path = GetRoundRectanglePath(rcArrowRect);

                    graphics.PaintPath(rectFillStyle, rectStrokeStyle, path);

                    path.Dispose();

                    rcArrowRect.Inflate(-5, -5);

                    // draw the arrow itself
                    if (rcArrowRect.Width <= 0 || rcArrowRect.Height <= 0)
                    {
                        continue;
                    }

                    if (dCurrentValue < dPreviousValue)
                    {
                        // draw negative arrow
                        path = GetArrowPath(rcArrowRect, false);

                        graphics.PaintPath(negativeArrowFillStyle, negativeArrowStrokeStyle, path);

                        path.Dispose();
                    }
                    else if (dCurrentValue > dPreviousValue)
                    {
                        // draw positive arrow
                        path = GetArrowPath(rcArrowRect, true);

                        graphics.PaintPath(positiveArrowFillStyle, positiveArrowStrokeStyle, path);

                        path.Dispose();
                    }
                    else
                    {
                        // draw equal sign
                        NRectangleF rect = new NRectangleF(rcArrowRect.Left, rcArrowRect.Top, rcArrowRect.Width, rcArrowRect.Height / 3.0f);

                        graphics.PaintRectangle(equalSignFillStyle, equalSignStrokeStyle, rect);

                        rect = new NRectangleF(rcArrowRect.Left, rcArrowRect.Bottom - rect.Height, rcArrowRect.Width, rect.Height);

                        graphics.PaintRectangle(equalSignFillStyle, equalSignStrokeStyle, rect);
                    }
                }
            }
コード例 #16
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;
                }
            }
        }