Exemplo n.º 1
0
 void nChartControl1_MouseUp(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         nChartControl1.Controller.Tools.Clear();
         NDragTool dragTool = null;
         dragTool = new NTrackballTool();
         nChartControl1.Controller.Tools.Add(dragTool);
     }
     //<GS-07062010>
     //CastSurfaceGraphChangedEventEx(nChartControl1.Charts[0].Projection.XDepth, nChartControl1.Charts[0].Projection.YDepth, nChartControl1.Charts[0].Projection.Zoom, nChartControl1.Charts[0].Projection.Rotation, nChartControl1.Charts[0].Projection.Elevation);
 }
Exemplo n.º 2
0
        private void MouseModeComboBox_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            NTool tool = null;
            bool  bEnableCreatePointControls = false;

            switch (MouseModeComboBox.SelectedIndex)
            {
            // Create Point
            case 0:
                bEnableCreatePointControls = true;
                break;

            // Trackball
            case 1:
                tool = new NTrackballTool();
                break;

            // Zoom
            case 2:
                tool = new NZoomTool();
                break;

            // Offset
            case 3:
                tool = new NOffsetTool();
                break;
            }

            nChartControl1.Controller.Tools.Clear();

            if (tool != null)
            {
                nChartControl1.Controller.Tools.Add(tool);
            }

            CreatePointAtPlaneComboBox.Enabled = bEnableCreatePointControls;

            if (CreatePointAtPlaneComboBox.SelectedIndex == 0)
            {
                XZPlaneValueNumericUpDown.Enabled = bEnableCreatePointControls;
                XYPlaneValueNumericUpDown.Enabled = false;
            }
            else
            {
                XZPlaneValueNumericUpDown.Enabled = false;
                XYPlaneValueNumericUpDown.Enabled = bEnableCreatePointControls;
            }
        }
Exemplo n.º 3
0
        private void DragModeComboBox_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            NDragTool dragTool = null;

            if (nChartControl1.Controller.Tools.Count > 0)
            {
                dragTool = nChartControl1.Controller.Tools[0] as NDragTool;
            }

            if (dragTool != null)
            {
                dragTool.Drag -= new EventHandler(OnViewChange);
                dragTool       = null;
            }

            nChartControl1.Controller.Tools.Clear();

            switch (DragModeComboBox.SelectedIndex)
            {
            // Trackball
            case 1:
                dragTool = new NTrackballTool();
                break;

            // Zoom
            case 2:
                dragTool = new NZoomTool();
                break;

            // Offset
            case 3:
                dragTool = new NOffsetTool();
                break;
            }

            if (dragTool != null)
            {
                dragTool.Drag += new EventHandler(OnViewChange);
                nChartControl1.Controller.Tools.Add(dragTool);
            }
        }
Exemplo n.º 4
0
        void nChartControl1_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                nChartControl1.Controller.Tools.Clear();
                NDragTool dragTool = null;
                dragTool = new NTrackballTool();
                nChartControl1.Controller.Tools.Add(dragTool);
            }
            //<GS-07062010>
            CastSurfaceGraphChangedEventEx(nChartControl1.Charts[0].Projection.XDepth, nChartControl1.Charts[0].Projection.YDepth, nChartControl1.Charts[0].Projection.Zoom, nChartControl1.Charts[0].Projection.Rotation, nChartControl1.Charts[0].Projection.Elevation);


        }
Exemplo n.º 5
0
        public override void Initialize()
        {
            base.Initialize();

            // configure the trackball
            NTrackballTool trackballTool = new NTrackballTool();

            trackballTool.ProjectionChanged += new EventHandler(OnProjectionChanged);
            nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
            nChartControl1.Controller.Tools.Add(trackballTool);

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

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);
            title.DockMode            = PanelDockMode.Top;
            title.Margins             = new NMarginsL(10, 10, 10, 10);
            title.ContentAlignment    = ContentAlignment.BottomCenter;
            title.Location            = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));
            title.SendToBack();

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

            // setup the chart
            m_Chart          = (NCartesianChart)nChartControl1.Charts[0];
            m_Chart.Enable3D = true;
            m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted);
            m_Chart.Depth               = 50;
            m_Chart.Width               = 50;
            m_Chart.Height              = 50;
            m_Chart.BorderStyle         = new NStrokeBorderStyle(BorderShape.RoundedRect);
            m_Chart.BoundsMode          = BoundsMode.Fit;
            m_Chart.DockMode            = PanelDockMode.Fill;
            m_Chart.Margins             = new NMarginsL(30, 0, 30, 30);
            m_Chart.Padding             = new NMarginsL(5, 5, 5, 5);
            m_Chart.BackgroundFillStyle = new NGradientFillStyle(Color.White, Color.LightGray);

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

            scaleY.Title.Text = "Values";

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

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

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

            // configure the x axis labels (categories)
            NOrdinalScaleConfigurator scaleX = (NOrdinalScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator;

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

            for (int j = 0; j < categoriesCount; j++)
            {
                scaleX.Labels.Add("Category " + j.ToString());
            }

            // configure the depth axis labels (series)
            NOrdinalScaleConfigurator scaleZ = m_Chart.Axis(StandardAxis.Depth).ScaleConfigurator as NOrdinalScaleConfigurator;

            scaleZ.AutoLabels    = false;
            scaleZ.Title.Text    = "Series Title";
            scaleZ.MajorTickMode = MajorTickMode.CustomStep;
            scaleZ.Labels.Add("Series 1");
            scaleZ.Labels.Add("Series 2");
            scaleZ.Labels.Add("Series 3");
            scaleZ.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            scaleZ.LabelFitModes = new LabelFitMode[] { LabelFitMode.Stagger2, LabelFitMode.AutoScale };

            // add series
            for (int i = 0; i < 3; i++)
            {
                NBarSeries bar = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);
                bar.InflateMargins         = true;
                bar.BarShape               = BarShape.SmoothEdgeBar;
                bar.DataLabelStyle.Visible = false;
                bar.Name = "Series " + i.ToString();
                bar.Values.FillRandomRange(Random, categoriesCount, 10, 30);
            }

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

            styleSheet.Apply(nChartControl1.Document);

            // initialize controls on the form
            AngleModeComboBox.FillFromEnum(typeof(ScaleLabelAngleMode));
            AngleModeComboBox.SelectedIndex = (int)ScaleLabelAngleMode.Scale;
            Use3DCheckBox.Checked           = true;

            OnProjectionChanged(null, null);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            NThinChartControl1.StateId = "Chart1";

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

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

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

                // configure the legend
                NLegend legend = new NLegend();
                NThinChartControl1.Panels.Add(legend);
                legend.DockMode = PanelDockMode.Right;
                legend.Padding  = new NMarginsL(1, 1, 3, 3);
                legend.FillStyle.SetTransparencyPercent(50);
                legend.OuterBottomBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel);
                legend.OuterLeftBorderStyle.Width   = new NLength(0, NGraphicsUnit.Pixel);
                legend.OuterRightBorderStyle.Width  = new NLength(0, NGraphicsUnit.Pixel);
                legend.OuterTopBorderStyle.Width    = new NLength(0, NGraphicsUnit.Pixel);
                legend.HorizontalBorderStyle.Width  = new NLength(0, NGraphicsUnit.Pixel);
                legend.VerticalBorderStyle.Width    = new NLength(0, NGraphicsUnit.Pixel);

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

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

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

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

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

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

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

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

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

                NThinChartControl1.AutoUpdateCallback = new NAutoUpdateCallback();

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

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

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

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

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

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

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

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

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

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

                NThinChartControl1.CustomRequestCallback = new CustomRequestCallback();
            }
        }
Exemplo n.º 7
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("Trackball Tool");

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

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

            tbt.Exclusive = true;
            tbt.Enabled   = true;

            control.Controller.SetActivePanel(chart);
            control.Controller.Tools.Add(tbt);
        }