public override void Initialize()
        {
            base.Initialize();

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

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

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

            // setup chart
            m_Chart                      = nChartControl1.Charts[0];
            m_Chart.Enable3D             = true;
            m_Chart.Width                = 60;
            m_Chart.Height               = 25;
            m_Chart.Depth                = 45;
            m_Chart.Projection.Type      = ProjectionType.Perspective;
            m_Chart.Projection.Elevation = 28;
            m_Chart.Projection.Rotation  = -17;
            m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);

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

            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            stripStyle.Interlaced = true;
            ((NStandardScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator).StripStyles.Add(stripStyle);

            // show the X axis gridlines
            NOrdinalScaleConfigurator ordinalScale = m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;

            ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);

            // add the first line
            m_Line1 = (NLineSeries)m_Chart.Series.Add(SeriesType.Line);
            m_Line1.MultiLineMode          = MultiLineMode.Series;
            m_Line1.LineSegmentShape       = LineSegmentShape.Tape;
            m_Line1.DataLabelStyle.Visible = false;
            m_Line1.DepthPercent           = 50;
            m_Line1.Name = "Line 1";

            // add the second line
            m_Line2 = (NLineSeries)m_Chart.Series.Add(SeriesType.Line);
            m_Line2.MultiLineMode          = MultiLineMode.Series;
            m_Line2.LineSegmentShape       = LineSegmentShape.Tape;
            m_Line2.DataLabelStyle.Visible = false;
            m_Line2.DepthPercent           = 50;
            m_Line2.Name = "Line 2";

            // add the third line
            m_Line3 = (NLineSeries)m_Chart.Series.Add(SeriesType.Line);
            m_Line3.MultiLineMode          = MultiLineMode.Series;
            m_Line3.LineSegmentShape       = LineSegmentShape.Tape;
            m_Line3.DataLabelStyle.Visible = false;
            m_Line3.DepthPercent           = 50;
            m_Line3.Name = "Line 3";

            GenerateData();

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

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

            styleSheet.Apply(nChartControl1.Document);
        }
Beispiel #2
0
        private void ImportData()
        {
            NDrawingDocument document = NDrawingView1.Document;

            document.BackgroundStyle.FrameStyle.Visible = false;

            // create two stylesheets - one for the vertices and one for the edges
            NStyleSheet vertexStyleSheet = new NStyleSheet();

            vertexStyleSheet.Name = "Vertices";
            NStyle.SetFillStyle(vertexStyleSheet, new NColorFillStyle(Color.FromArgb(236, 97, 49)));
            document.StyleSheets.AddChild(vertexStyleSheet);

            NStyleSheet edgeStyleSheet = new NStyleSheet();

            edgeStyleSheet.Name = "Edges";
            NStyle.SetStrokeStyle(edgeStyleSheet, new NStrokeStyle(Color.Blue));
            NStyle.SetEndArrowheadStyle(edgeStyleSheet, new NArrowheadStyle(ArrowheadShape.OpenedArrow, null, new NSizeL(6, 4), null, new NStrokeStyle(Color.Blue)));
            NTextStyle textStyle = (NTextStyle)document.ComposeTextStyle().Clone();

            textStyle.StringFormatStyle.VertAlign = Nevron.VertAlign.Bottom;
            NStyle.SetTextStyle(edgeStyleSheet, textStyle);
            document.StyleSheets.AddChild(edgeStyleSheet);

            // create the graph data source importer
            NGraphDataSourceImporter graphImporter = new NGraphDataSourceImporter();

            // set the document in the active layer of which the shapes will be imported
            graphImporter.Document = document;

            // SET THE DATA SOURCE
            // the tree data source importer supports the following data sources
            //      DataTable
            //      DataView
            //      OleDbDataAdapter
            //      SqlDataAdapter
            //      OdbcDataAdapter
            //      OleDbCommand
            //      SqlCommand
            //      OdbcCommand
            // in this example we have created an OleDbDataAdapter,
            // which selects all columns and records from the Sources and Links tables of the Data.xlsx file
            string databasePath     = Server.MapPath(@"..\Examples\Import\Data.xlsx");
            string connectionString = @"Data Source=""" + databasePath + @""";Provider=""Microsoft.ACE.OLEDB.12.0""; Extended Properties=""Excel 12.0 Xml;HDR=YES"";";

            graphImporter.VertexDataSource = new OleDbDataAdapter("SELECT * FROM [Sources$]", connectionString);
            graphImporter.EdgeDataSource   = new OleDbDataAdapter("SELECT * FROM [Links$]", connectionString);

            // vertex records are uniquely identified by their Id (in the Sources table)
            // edges link the vertices with the Fro and ToPageId (in the Links table)
            graphImporter.VertexIdColumnName     = "Id";
            graphImporter.FromVertexIdColumnName = "From";
            graphImporter.ToVertexIdColumnName   = "To";

            // create vertices as group shapes, with default size
            NShapesFactory shapesFactory = new GroupShapesFactory();

            shapesFactory.DefaultSize         = VertexSize;
            graphImporter.VertexShapesFactory = shapesFactory;
            graphImporter.VertexShapesName    = GroupShapes.Group.ToString();

            // set stylesheets to be applied to imported vertices and edges
            graphImporter.VertexStyleSheetName = "Vertices";
            graphImporter.EdgeStyleSheetName   = "Edges";

            // use layered graph layout
            NLayeredGraphLayout layout = new NLayeredGraphLayout();

            layout.LayerSpacing   = 70;
            layout.Direction      = LayoutDirection.LeftToRight;
            layout.LayerAlignment = RelativeAlignment.Near;
            graphImporter.Layout  = layout;

            // subscribe for the vertex and edge imported events,
            // which are raised when a shape was created for a data source record
            graphImporter.VertexImported += new ShapeImportedDelegate(OnVertexImported);
            graphImporter.EdgeImported   += new ShapeImportedDelegate(OnEdgeImported);

            // import
            graphImporter.Import();
        }
        public override void Initialize()
        {
            base.Initialize();

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

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("XYZ Bars");

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

            // chart settings
            m_Chart          = nChartControl1.Charts[0];
            m_Chart.Enable3D = true;
            m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted);
            m_Chart.Projection.Elevation -= 10;
            m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
            m_Chart.Depth  = 55.0f;
            m_Chart.Width  = 55.0f;
            m_Chart.Height = 55.0f;

            // switch the PrimaryX and Depth axes in numeric mode in order to correctly scale the custom X and Z positions
            NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator();

            m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;

            linearScale = new NLinearScaleConfigurator();
            m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;

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

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

            linearScale = new NLinearScaleConfigurator();
            m_Chart.Axis(StandardAxis.Depth).ScaleConfigurator = linearScale;
            linearScale.MajorGridStyle.LineStyle.Pattern       = LinePattern.Dot;
            linearScale.MajorGridStyle.LineStyle.Pattern       = LinePattern.Dot;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true);

            // create the shape series
            m_Shape = (NShapeSeries)m_Chart.Series.Add(SeriesType.Shape);

            // show information about the data points in the legend
            m_Shape.Legend.Mode = SeriesLegendMode.DataPoints;

            // show the Y size and label in the legend
            m_Shape.Legend.Format = "<ysize> <label>";

            // show the Y size and label in the data point labels
            m_Shape.DataLabelStyle.Format = "<ysize> <label>";

            // use custom X positions
            m_Shape.UseXValues = true;

            // use custom Z positions
            m_Shape.UseZValues = true;

            // X sizes are specified in Model units (the default is Scale)
            // this will make the bars size independant from the scale of the X axis
            m_Shape.XSizesUnits = MeasurementUnits.Model;

            // Z sizes are specified in Model units (the default is Scale)
            // this will make the bars size independant from the scale of the Z axis
            m_Shape.ZSizesUnits = MeasurementUnits.Model;

            // this will require to set the InflateMargins flag to true since in this mode
            // scale is determined only by the X positions of the shape and will not take
            // into account the size of the bars.
            m_Shape.InflateMargins = true;

            // add the bars
            // add Bar1
            m_Shape.AddDataPoint(new NShapeDataPoint(
                                     20,    // Y center of bar -> half its Y size
                                     12,    // X position
                                     56,    // Z position
                                     10,    // X size - 10 model units
                                     40,    // Y size of bar
                                     10,    // Z size - 10 model units
                                     "Bar1" // label
                                     ));

            // add Bar2
            m_Shape.AddDataPoint(new NShapeDataPoint(
                                     8,     // Y center of bar -> half its Y size
                                     24,    // X position
                                     12,    // Z position
                                     10,    // X size - 10 model units
                                     16,    // Y size of bar
                                     10,    // Z size - 10 model units
                                     "Bar2" // label
                                     ));

            // add Bar3
            m_Shape.AddDataPoint(new NShapeDataPoint(
                                     15,    // Y center of bar -> half its Y size
                                     50,    // X position
                                     30,    // Z position
                                     10,    // X size - 10 model units
                                     30,    // Y size of bar
                                     10,    // Z size - 10 model units
                                     "Bar3" // label
                                     ));

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

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

            styleSheet.Apply(nChartControl1.Document);

            // init form controls
            InflateMarginsCheckBox.Checked = true;
            AxesRoundToTickCheck.Checked   = true;
            StyleCombo.SelectedIndex       = 0;
        }
Beispiel #4
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                WebExamplesUtilities.FillComboWithValues(LeftAxisPositionValueDropDownList, -10, 10, 1);
                WebExamplesUtilities.FillComboWithValues(BottomAxisPositionValueDropdownList, -10, 10, 1);

                LeftAxisPositionValueDropDownList.SelectedIndex   = 10;
                BottomAxisPositionValueDropdownList.SelectedIndex = 10;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel header = nChartControl1.Labels.AddHeader("Axis Value Crossing <br/> <font size = '9pt'>Demonstrates how to use the value cross anchor</font>");

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

            // setup chart
            m_Chart            = nChartControl1.Charts[0];
            m_Chart.BoundsMode = BoundsMode.Stretch;
            m_Chart.Location   = new NPointL(
                new NLength(7, NRelativeUnit.ParentPercentage),
                new NLength(18, NRelativeUnit.ParentPercentage));
            m_Chart.Size = new NSizeL(
                new NLength(86, NRelativeUnit.ParentPercentage),
                new NLength(75, NRelativeUnit.ParentPercentage));

            // configure scales
            NLinearScaleConfigurator yScaleConfigurator = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;
            NScaleStripStyle         yStripStyle        = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(40, Color.LightGray)), null, true, 0, 0, 1, 1);

            yStripStyle.SetShowAtWall(ChartWallType.Back, true);
            yStripStyle.Interlaced = true;
            yScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            yScaleConfigurator.StripStyles.Add(yStripStyle);

            NLinearScaleConfigurator xScaleConfigurator = new NLinearScaleConfigurator();
            NScaleStripStyle         xStripStyle        = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(40, Color.LightGray)), null, true, 0, 0, 1, 1);

            xStripStyle.SetShowAtWall(ChartWallType.Back, true);
            xStripStyle.Interlaced = true;
            xScaleConfigurator.StripStyles.Add(xStripStyle);
            xScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = xScaleConfigurator;

            // cross X and Y axes
            if (BottomUsePositionCheckBox.Checked)
            {
                m_Chart.Axis(StandardAxis.PrimaryX).Anchor = new NCrossAxisAnchor(AxisOrientation.Horizontal, new NValueAxisCrossing(m_Chart.Axis(StandardAxis.PrimaryY), Convert.ToDouble(BottomAxisPositionValueDropdownList.SelectedValue)));
                m_Chart.Axis(StandardAxis.PrimaryX).Anchor.RulerOrientation = RulerOrientation.Right;
            }

            if (LeftUsePositionCheckBox.Checked)
            {
                m_Chart.Axis(StandardAxis.PrimaryY).Anchor = new NCrossAxisAnchor(AxisOrientation.Vertical, new NValueAxisCrossing(m_Chart.Axis(StandardAxis.PrimaryX), Convert.ToDouble(LeftAxisPositionValueDropDownList.SelectedValue)));
            }

            m_Chart.Axis(StandardAxis.Depth).Visible  = false;
            m_Chart.Wall(ChartWallType.Floor).Visible = false;
            m_Chart.Wall(ChartWallType.Left).Visible  = false;

            // setup bubble series
            NBubbleSeries bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble);

            bubble.Name                   = "Bubble Series";
            bubble.InflateMargins         = true;
            bubble.DataLabelStyle.Visible = false;
            bubble.UseXValues             = true;
            bubble.ShadowStyle.Type       = ShadowType.GaussianBlur;
            bubble.BubbleShape            = PointShape.Sphere;
            bubble.Legend.Mode            = SeriesLegendMode.None;

            // fill with random data
            bubble.Values.FillRandomRange(Random, 10, -20, 20);
            bubble.XValues.FillRandomRange(Random, 10, -20, 20);
            bubble.Sizes.FillRandomRange(Random, 10, 1, 6);

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

            styleSheet.Apply(nChartControl1.Document);
        }
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = new NLabel("Date Time Stack Float Bar");

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

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

            chart.BoundsMode = BoundsMode.Stretch;

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

            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            stripStyle.Interlaced = true;
            linearScale.StripStyles.Add(stripStyle);
            chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale;

            NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator();

            dateTimeScale.LabelValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.Date);
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale;

            // setup the floatbar series
            NFloatBarSeries floatbar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar);

            floatbar.MultiFloatBarMode = MultiFloatBarMode.Series;
            floatbar.Name = "Floatbar series";
            floatbar.DataLabelStyle.Visible = false;
            floatbar.UseXValues             = true;
            floatbar.InflateMargins         = true;

            // setup the bar series
            NBarSeries bar1 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar1.Name                   = "Bar series";
            bar1.MultiBarMode           = MultiBarMode.Stacked;
            bar1.DataLabelStyle.Visible = false;

            // setup the bar series
            NBarSeries bar2 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar2.Name                   = "Bar series";
            bar2.MultiBarMode           = MultiBarMode.Stacked;
            bar2.DataLabelStyle.Visible = false;

            GeneratePosData();
            GenerateXData();

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

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

            styleSheet.Apply(nChartControl1.Document);

            nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
            nChartControl1.Controller.Tools.Add(new NTrackballTool());
        }
Beispiel #6
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("XYZ Line Chart");

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

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

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

            chart.Enable3D = true;
            chart.Width    = 70;
            chart.Height   = 70;
            chart.Depth    = 70;
            chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
            chart.Axis(StandardAxis.Depth).Visible = true;

            // configure the depth axis
            NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator();

            chart.Axis(StandardAxis.Depth).ScaleConfigurator = linearScale;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;

            // configure the horz axis
            linearScale = new NLinearScaleConfigurator();
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale;

            linearScale.LabelFitModes = new LabelFitMode[0];

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

            // configure the y axis
            linearScale = new NLinearScaleConfigurator();
            chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale;

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

            // add the line
            NLineSeries line = (NLineSeries)chart.Series.Add(SeriesType.Line);

            line.LineSegmentShape       = LineSegmentShape.Line;
            line.DataLabelStyle.Visible = false;
            line.Legend.Mode            = SeriesLegendMode.Series;
            line.InflateMargins         = true;
            line.MarkerStyle.Visible    = false;
            line.Name       = "Line Series";
            line.UseXValues = true;
            line.UseZValues = true;

            ChangeData();

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

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

            styleSheet.Apply(nChartControl1.Document);

            nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
            nChartControl1.Controller.Tools.Add(new NTrackballTool());
        }
Beispiel #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // switch to OpenGL rendering
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

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

            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 = true;
            chart.Width    = 50;
            chart.Depth    = 50;
            chart.Height   = 50;
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
            chart.Projection.Type      = ProjectionType.Perspective;
            chart.Projection.Elevation = 25;
            chart.Projection.Rotation  = -18;

            // setup Y axis
            NLinearScaleConfigurator linearScaleConfigurator = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;

            linearScaleConfigurator.RoundToTickMin = AxesRoundToTickCheckBox.Checked;
            linearScaleConfigurator.RoundToTickMax = AxesRoundToTickCheckBox.Checked;
            linearScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScaleConfigurator.LabelStyle.TextStyle.FontStyle   = new NFontStyle("Arial", 8);

            // 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);
            linearScaleConfigurator.StripStyles.Add(stripStyle);

            // setup X axis
            linearScaleConfigurator = new NLinearScaleConfigurator();
            linearScaleConfigurator.RoundToTickMin = AxesRoundToTickCheckBox.Checked;
            linearScaleConfigurator.RoundToTickMax = AxesRoundToTickCheckBox.Checked;
            linearScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScaleConfigurator.LabelStyle.TextStyle.FontStyle   = new NFontStyle("Arial", 8);
            linearScaleConfigurator.MajorGridStyle.ShowAtWalls       = new ChartWallType[] { ChartWallType.Back, ChartWallType.Floor };

            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScaleConfigurator;

            // setup Z axis
            linearScaleConfigurator = new NLinearScaleConfigurator();
            linearScaleConfigurator.RoundToTickMin = AxesRoundToTickCheckBox.Checked;
            linearScaleConfigurator.RoundToTickMax = AxesRoundToTickCheckBox.Checked;
            linearScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScaleConfigurator.LabelStyle.TextStyle.FontStyle   = new NFontStyle("Arial", 8);
            linearScaleConfigurator.MajorGridStyle.ShowAtWalls       = new ChartWallType[] { ChartWallType.Left, ChartWallType.Floor };
            chart.Axis(StandardAxis.Depth).ScaleConfigurator         = linearScaleConfigurator;

            // setup point series
            NPointSeries point = (NPointSeries)chart.Series.Add(SeriesType.Point);

            point.Name                   = "Point1";
            point.InflateMargins         = InflateMarginsCheckBox.Checked;
            point.DataLabelStyle.Visible = false;
            point.Legend.Mode            = SeriesLegendMode.None;
            point.PointShape             = PointShape.Bar;
            point.BorderStyle.Color      = Color.AliceBlue;
            point.Size                   = new NLength(3, NRelativeUnit.ParentPercentage);
            point.UseXValues             = true;
            point.UseZValues             = true;

            // init the chart with some random values
            point.Values.FillRandomRange(Random, 10, -50, 50);
            point.XValues.FillRandomRange(Random, 10, -50, 50);
            point.ZValues.FillRandomRange(Random, 10, -50, 50);

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

            styleSheet.Apply(nChartControl1.Document);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
Beispiel #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
            nChartControl1.Panels.Clear();

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

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.DockMode            = PanelDockMode.Top;
            title.Margins             = new NMarginsL(10, 10, 10, 0);
            nChartControl1.Panels.Add(title);

            // setup chart
            NCartesianChart chart = new NCartesianChart();

            nChartControl1.Panels.Add(chart);

            chart.DockMode = PanelDockMode.Fill;
            chart.Margins  = new NMarginsL(new NLength(10));
            chart.Padding  = new NMarginsL(2);

            chart.Enable3D         = true;
            chart.Width            = 50;
            chart.Height           = 50;
            chart.Depth            = 50;
            chart.BoundsMode       = BoundsMode.Fit;
            chart.ContentAlignment = ContentAlignment.BottomRight;
            chart.Location         = new NPointL(new NLength(15, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage));
            chart.Size             = new NSizeL(new NLength(70, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage));
            chart.Wall(ChartWallType.Back).Width  = 0.01f;
            chart.Wall(ChartWallType.Floor).Width = 0.01f;
            chart.Wall(ChartWallType.Left).Width  = 0.01f;

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

            // add axis labels
            NOrdinalScaleConfigurator ordinalScale = chart.Axis(StandardAxis.Depth).ScaleConfigurator as NOrdinalScaleConfigurator;

            ordinalScale.AutoLabels = false;
            ordinalScale.Labels.Add("Miami");
            ordinalScale.Labels.Add("Chicago");
            ordinalScale.Labels.Add("Los Angeles");
            ordinalScale.Labels.Add("New York");
            ordinalScale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0);

            ordinalScale = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;
            ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);

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

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

            int barsCount = 7;

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

            bar1.MultiBarMode           = MultiBarMode.Series;
            bar1.Name                   = "Bar1";
            bar1.DataLabelStyle.Visible = false;
            bar1.BorderStyle.Color      = Color.FromArgb(210, 210, 255);

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

            bar2.MultiBarMode           = MultiBarMode.Series;
            bar2.Name                   = "Bar2";
            bar2.DataLabelStyle.Visible = false;
            bar2.BorderStyle.Color      = Color.FromArgb(210, 255, 210);

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

            bar3.MultiBarMode           = MultiBarMode.Series;
            bar3.Name                   = "Bar3";
            bar3.DataLabelStyle.Visible = false;
            bar3.BorderStyle.Color      = Color.FromArgb(255, 255, 210);

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

            bar4.MultiBarMode           = MultiBarMode.Series;
            bar4.Name                   = "Bar4";
            bar4.DataLabelStyle.Visible = false;
            bar4.BorderStyle.Color      = Color.FromArgb(255, 210, 210);

            // fill with random data
            bar1.Values.FillRandomRange(Random, barsCount, 10, 40);
            bar2.Values.FillRandomRange(Random, barsCount, 30, 60);
            bar3.Values.FillRandomRange(Random, barsCount, 50, 80);
            bar4.Values.FillRandomRange(Random, barsCount, 70, 100);

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

            styleSheet.Apply(nChartControl1.Document);

            if (!IsPostBack)
            {
                // init form controls
                WebExamplesUtilities.FillComboWithValues(XProportionDropDownList, 1, 5, 1);
                XProportionDropDownList.SelectedIndex = 0;

                WebExamplesUtilities.FillComboWithValues(YProportionDropDownList, 1, 5, 1);
                YProportionDropDownList.SelectedIndex = 0;

                WebExamplesUtilities.FillComboWithValues(DepthProportionDropDownList, 1, 5, 1);
                DepthProportionDropDownList.SelectedIndex = 0;

                Fit3DAxisContentCheckBox.Checked = true;
                ShowContentAreaCheckBox.Checked  = false;
            }

            chart.Width  = (XProportionDropDownList.SelectedIndex + 1) * 10;
            chart.Height = (YProportionDropDownList.SelectedIndex + 1) * 10;
            chart.Depth  = (DepthProportionDropDownList.SelectedIndex + 1) * 10;

            float max = Math.Max(Math.Max(chart.Width, chart.Height), chart.Depth);

            float scale = 50 / max;

            chart.Width  *= scale;
            chart.Height *= scale;
            chart.Depth  *= scale;

            chart.Fit3DAxisContent = Fit3DAxisContentCheckBox.Checked;

            if (ShowContentAreaCheckBox.Checked)
            {
                chart.BorderStyle = new NStrokeBorderStyle();
            }
            else
            {
                chart.BorderStyle = null;
            }
        }
Beispiel #9
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
            nChartControl1.Controller.Tools.Add(new NTrackballTool());

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

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

            m_PieChart          = new NPieChart();
            m_PieChart.Enable3D = true;
            nChartControl1.Charts.Clear();
            nChartControl1.Charts.Add(m_PieChart);

            m_PieChart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalElevated);
            m_PieChart.LightModel.SetPredefinedLightModel(PredefinedLightModel.NorthernLights);

            m_PieChart.DisplayOnLegend = nChartControl1.Legends[0];
            m_PieChart.Location        = new NPointL(new NLength(15, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage));
            m_PieChart.Size            = new NSizeL(new NLength(70, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage));
            m_PieChart.InnerRadius     = new NLength(10, NRelativeUnit.ParentPercentage);

            Random random = new Random();

            string[] labels = new string[] { "Ships", "Trains", "Automobiles", "Airplanes" };

            for (int i = 0; i < 4; i++)
            {
                NPieSeries pieSeries = new NPieSeries();

                // create a small detachment between pie rings
                pieSeries.BeginRadiusPercent = 10;
                pieSeries.PieStyle           = PieStyle.Ring;

                m_PieChart.Series.Add(pieSeries);

                pieSeries.DataLabelStyle.ArrowLength        = new NLength(0);
                pieSeries.DataLabelStyle.ArrowPointerLength = new NLength(0);
                pieSeries.DataLabelStyle.Format             = "<percent>";

                if (i == 0)
                {
                    pieSeries.Legend.Mode   = SeriesLegendMode.DataPoints;
                    pieSeries.Legend.Format = "<label>";
                }
                else
                {
                    pieSeries.Legend.Mode = SeriesLegendMode.None;
                }

                pieSeries.LabelMode = PieLabelMode.Center;

                for (int j = 0; j < labels.Length; j++)
                {
                    pieSeries.Values.Add(20 + random.Next(100));
                    pieSeries.Labels.Add(labels[j]);
                }
            }

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

            styleSheet.Apply(nChartControl1.Document);

            nChartControl1.Refresh();
        }
Beispiel #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ImageBorderDropDownList.Items.Add("Common");
                ImageBorderDropDownList.Items.Add("Embed");
                ImageBorderDropDownList.Items.Add("Emboss");
                ImageBorderDropDownList.Items.Add("Rounded");
                ImageBorderDropDownList.Items.Add("RoundedBorder");
                ImageBorderDropDownList.Items.Add("Rectangular");
                ImageBorderDropDownList.Items.Add("Thin");
                ImageBorderDropDownList.Items.Add("Thick");
                ImageBorderDropDownList.Items.Add("OuterRounded");
                ImageBorderDropDownList.Items.Add("OpenLeft");
                ImageBorderDropDownList.Items.Add("OpenRight");

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

                ImageBorderDropDownList.SelectedIndex = 6;
            }

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

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

            nChartControl1.BackgroundStyle.FrameStyle = imageFrameStyle;

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

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

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

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

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

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

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

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

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

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

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

            styleSheet.Apply(nChartControl1.Document);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LegendModeDropDownList.Items.Add("Disabled");
                LegendModeDropDownList.Items.Add("Automatic");
                LegendModeDropDownList.Items.Add("Manual");
                LegendModeDropDownList.SelectedIndex = 1;

                PredefinedStyleDropDownList.Items.Add("Top");
                PredefinedStyleDropDownList.Items.Add("Bottom");
                PredefinedStyleDropDownList.Items.Add("Left");
                PredefinedStyleDropDownList.Items.Add("Right");
                PredefinedStyleDropDownList.Items.Add("Top right");
                PredefinedStyleDropDownList.Items.Add("Top left");
                PredefinedStyleDropDownList.SelectedIndex = 4;

                ExpandModeDropDownList.Items.Add("Rows only");
                ExpandModeDropDownList.Items.Add("Cols only");
                ExpandModeDropDownList.Items.Add("Rows fixed");
                ExpandModeDropDownList.Items.Add("Cols fixed");
                ExpandModeDropDownList.SelectedIndex = 0;

                WebExamplesUtilities.FillComboWithValues(ManualItemsDropDownList, 1, 20, 1);
                ManualItemsDropDownList.SelectedIndex = 5;

                WebExamplesUtilities.FillComboWithValues(RowCountDropDownList, 1, 10, 1);
                RowCountDropDownList.SelectedIndex = 5;

                WebExamplesUtilities.FillComboWithValues(ColCountDropDownList, 1, 10, 1);
                ColCountDropDownList.SelectedIndex = 5;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
            nChartControl1.Settings.JitterMode     = JitterMode.Enabled;
            nChartControl1.Settings.JitteringSteps = 4;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Legend General");

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

            // setup the chart
            NChart     chart     = nChartControl1.Charts[0];
            NBarSeries barSeries = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            barSeries.DataLabelStyle.Visible = false;
            barSeries.Legend.Mode            = SeriesLegendMode.DataPoints;
            barSeries.Legend.Format          = "<label> <percent>";
            barSeries.Values.FillRandom(Random, numberOfDataPoints);

            for (int i = 0; i < numberOfDataPoints; i++)
            {
                barSeries.Labels.Add("Item " + i.ToString());
            }

            // setup the legend
            m_Legend = nChartControl1.Legends[0];
            m_Legend.FillStyle.SetTransparencyPercent(50);
            m_Legend.Mode = ((LegendMode)LegendModeDropDownList.SelectedIndex);

            if (m_Legend.Mode != LegendMode.Manual)
            {
                ManualItemsDropDownList.Enabled = false;
            }
            else
            {
                NLegendItemCellData legendItemCellData;
                ManualItemsDropDownList.Enabled = true;

                // fill some manual legend data items.
                int manualItemCount = ManualItemsDropDownList.SelectedIndex + 1;
                for (int i = 0; i < manualItemCount; i++)
                {
                    legendItemCellData = new NLegendItemCellData();

                    legendItemCellData.Text      = "Manual item " + i.ToString();
                    legendItemCellData.MarkShape = LegendMarkShape.Rectangle;

                    Color itemColor = WebExamplesUtilities.RandomColor();

                    legendItemCellData.MarkFillStyle = new NColorFillStyle(itemColor);

                    m_Legend.Data.Items.Add(legendItemCellData);
                }
            }

            m_Legend.Header.Text = LegendHeaderTextBox.Text;
            m_Legend.Footer.Text = LegendFooterTextBox.Text;

            m_Legend.SetPredefinedLegendStyle((PredefinedLegendStyle)PredefinedStyleDropDownList.SelectedIndex);
            m_Legend.Data.ExpandMode = (LegendExpandMode)ExpandModeDropDownList.SelectedIndex;

            if (m_Legend.Data.ExpandMode == LegendExpandMode.ColsOnly || m_Legend.Data.ExpandMode == LegendExpandMode.RowsOnly)
            {
                RowCountDropDownList.Enabled = false;
                ColCountDropDownList.Enabled = false;
            }
            else if (m_Legend.Data.ExpandMode == LegendExpandMode.RowsFixed)
            {
                RowCountDropDownList.Enabled = true;
                ColCountDropDownList.Enabled = false;

                m_Legend.Data.RowCount = RowCountDropDownList.SelectedIndex + 1;
            }
            else if (m_Legend.Data.ExpandMode == LegendExpandMode.ColsFixed)
            {
                RowCountDropDownList.Enabled = false;
                ColCountDropDownList.Enabled = true;

                m_Legend.Data.ColCount = ColCountDropDownList.SelectedIndex + 1;
            }

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

            styleSheet.Apply(nChartControl1.Document);
        }
Beispiel #12
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

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

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

            // setup legend
            NLegend legend = nChartControl1.Legends[0];

            legend.Visible = false;

            NChart chart = nChartControl1.Charts[0];

            chart.BoundsMode = BoundsMode.Stretch;

            int           shapeIndex   = 0;
            double        cellSize     = 100;
            double        shapePadding = 10;
            NChartPalette palette      = new NChartPalette(ChartPredefinedPalette.Nevron);

            for (int x = 0; x < 2; x++)
            {
                for (int y = 0; y < 2; y++)
                {
                    NGraphicsPathSeries graphicsPathSeries = new NGraphicsPathSeries();

                    double xmin = x * cellSize + shapePadding;
                    double ymin = y * cellSize + shapePadding;

                    double xmax      = xmin + cellSize - shapePadding;
                    double ymax      = ymin + cellSize - shapePadding;
                    double shapeSize = cellSize - 2 * shapePadding;

                    NGraphicsPath path = new NGraphicsPath();

                    switch (shapeIndex)
                    {
                    case 0:
                        // rectangle
                        graphicsPathSeries.Name = "Rectangle";
                        path.AddRectangle(xmin, ymin, xmax - xmin, ymax - ymin);
                        graphicsPathSeries.InteractivityStyle = new NInteractivityStyle("Rectangle");
                        break;

                    case 1:
                        // ellipse
                        graphicsPathSeries.Name = "Ellipse";
                        path.AddEllipse(xmin, ymin, xmax - xmin, ymax - ymin);
                        graphicsPathSeries.InteractivityStyle = new NInteractivityStyle("Ellipse");
                        break;

                    case 2:
                        // triangle
                        graphicsPathSeries.Name = "Triangle";
                        graphicsPathSeries.InteractivityStyle = new NInteractivityStyle("Triangle");
                        path.StartFigure((xmin + xmax) / 2.0, ymin);
                        path.LineTo(xmin, ymax);
                        path.LineTo(xmax, ymax);
                        path.CloseFigure();

                        break;

                    case 3:
                        // polygon
                        graphicsPathSeries.Name = "Polygon";
                        graphicsPathSeries.InteractivityStyle = new NInteractivityStyle("Polygon");
                        double xcenter = (xmin + xmax) / 2.0;
                        double ycenter = (ymin + ymax) / 2.0;

                        int    count  = 8;
                        double radius = shapeSize / 2;

                        for (int i = 0; i < count; i++)
                        {
                            double angle = Math.PI * 2 * (double)i / (double)count;


                            if (i == 0)
                            {
                                path.StartFigure(xcenter + Math.Cos(angle) * radius,
                                                 ycenter + Math.Sin(angle) * radius);
                            }
                            else
                            {
                                path.LineTo(xcenter + Math.Cos(angle) * radius,
                                            ycenter + Math.Sin(angle) * radius);
                            }
                        }

                        path.CloseFigure();
                        break;
                    }

                    graphicsPathSeries.FillStyle    = new NColorFillStyle(palette.SeriesColors[shapeIndex]);
                    graphicsPathSeries.GraphicsPath = path;

                    chart.Series.Add(graphicsPathSeries);

                    shapeIndex++;
                }
            }

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

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

            styleSheet.Apply(nChartControl1.Document);
        }
Beispiel #13
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                WebExamplesUtilities.FillComboWithEnumValues(LineStyleDropDownList, typeof(LineSegmentShape));
                LineStyleDropDownList.SelectedIndex = 0;
                RoundToTickCheck.Checked            = true;
                InflateMarginsCheck.Checked         = true;
            }

            nChartControl1.Settings.JitterMode = JitterMode.Enabled;
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("3D Step Line Chart");

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

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

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

            chart.Enable3D = true;
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
            chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1);

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

            scaleX.MajorTickMode = MajorTickMode.AutoMaxCount;

            // setup the Y axis
            NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;

            scaleY.RoundToTickMin = RoundToTickCheck.Checked;
            scaleY.RoundToTickMax = RoundToTickCheck.Checked;

            // add interlaced stripe
            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 Z axis
            chart.Axis(StandardAxis.Depth).Visible = false;

            // setup step line series
            NStepLineSeries stepLine = (NStepLineSeries)chart.Series.Add(SeriesType.StepLine);

            stepLine.Name                   = "Series 1";
            stepLine.DepthPercent           = 50;
            stepLine.LineSize               = 2;
            stepLine.Legend.Mode            = SeriesLegendMode.None;
            stepLine.FillStyle              = new NColorFillStyle(Color.OliveDrab);
            stepLine.DataLabelStyle.Visible = false;
            stepLine.DataLabelStyle.Format  = "<value>";
            stepLine.MarkerStyle.Visible    = true;
            stepLine.InflateMargins         = InflateMarginsCheck.Checked;

            Random random = new Random();

            stepLine.Values.FillRandom(random, 8);

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

            styleSheet.Apply(nChartControl1.Document);

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

            switch (LineStyleDropDownList.SelectedIndex)
            {
            case 0:                     // simple line
                stepLine.LineSegmentShape = LineSegmentShape.Line;
                SetupTapeMarkers(stepLine.MarkerStyle);
                break;

            case 1:                     // tape
                stepLine.LineSegmentShape = LineSegmentShape.Tape;
                SetupTapeMarkers(stepLine.MarkerStyle);
                break;

            case 2:                     // tube
                stepLine.LineSegmentShape = LineSegmentShape.Tube;
                SetupTubeMarkers(stepLine.MarkerStyle);
                break;

            case 3:                     // elipsoid
                stepLine.LineSegmentShape = LineSegmentShape.Ellipsoid;
                SetupTubeMarkers(stepLine.MarkerStyle);
                break;
            }
        }
Beispiel #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            nChartControl1.Panels.Clear();

            // add watermarks

            string[] divIds = new string[] { "toyota",
                                             "chevrolet",
                                             "ford",
                                             "volkswagen",
                                             "hyundai",
                                             "nissan",
                                             "mazda" };

            nChartControl1.BackgroundStyle.FillStyle          = new NColorFillStyle(Color.LightGray);
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // add header
            NLabel header = nChartControl1.Labels.AddHeader("Car Sales by Company");

            header.TextStyle.BackplaneStyle.Visible = false;
            header.TextStyle.TextFormat             = TextFormat.XML;
            header.TextStyle.ShadowStyle.Type       = ShadowType.GaussianBlur;
            header.TextStyle.FillStyle = new NColorFillStyle(Color.Black);
            header.DockMode            = PanelDockMode.Top;
            header.Margins             = new NMarginsL(0, 10, 0, 0);

            // by default the chart contains a cartesian chart which cannot display a pie series
            NDockPanel dockPanel = new NDockPanel();

            dockPanel.DockMode = PanelDockMode.Fill;
            dockPanel.PositionChildPanelsInContentBounds = true;
            dockPanel.Margins = new NMarginsL(10, 10, 10, 10);

            nChartControl1.Panels.Add(dockPanel);

            AddWatermark(dockPanel, "ToyotaLogo.png");
            AddWatermark(dockPanel, "ChevroletLogo.png");
            AddWatermark(dockPanel, "FordLogo.png");
            AddWatermark(dockPanel, "VolkswagenLogo.png");
            AddWatermark(dockPanel, "HyundaiLogo.png");
            AddWatermark(dockPanel, "NissanLogo.png");
            AddWatermark(dockPanel, "MazdaLogo.png");

            NPieChart pieChart = new NPieChart();

            dockPanel.ChildPanels.Add(pieChart);

            NPieSeries pieSeries = new NPieSeries();

            pieChart.Series.Add(pieSeries);

            // add some data
            pieSeries.AddDataPoint(new NDataPoint(11.6, "Toyota Corolla"));
            pieSeries.AddDataPoint(new NDataPoint(9.7, "Chevrolet Cruze"));
            pieSeries.AddDataPoint(new NDataPoint(9.3, "Ford Focus"));
            pieSeries.AddDataPoint(new NDataPoint(7.1, "Volkswagen Jetta"));
            pieSeries.AddDataPoint(new NDataPoint(7.0, "Hyundai Elantra"));
            pieSeries.AddDataPoint(new NDataPoint(6.1, "Nissan Versa"));
            pieSeries.AddDataPoint(new NDataPoint(5.9, "Mazda 3"));
            pieSeries.AddDataPoint(new NDataPoint(43.4, "Other"));

            pieSeries.PieStyle  = PieStyle.Torus;
            pieSeries.LabelMode = PieLabelMode.Center;

            // configure interactivity for data points
            for (int i = 0; i < pieSeries.Values.Count; i++)
            {
                NInteractivityStyle interactivityStyle = new NInteractivityStyle();

                if (i < nChartControl1.Watermarks.Count)
                {
                    string watermarkId = new NElementIdentifier(nChartControl1.Watermarks[i].Id).ToString();
                    interactivityStyle.CustomMapAreaAttribute.JScriptAttribute = "onmouseover = 'ShowWatermark(evt, \"" + watermarkId + "\", \"" + divIds[i] + "\")'";
                }
                else
                {
                    interactivityStyle.CustomMapAreaAttribute.JScriptAttribute = "onmouseover = 'ShowWatermark(evt, null, null)'";
                }

                pieSeries.InteractivityStyles.Add(i, interactivityStyle);
            }

            nChartControl1.InteractivityStyle.CustomMapAreaAttribute.JScriptAttribute = "onmouseover = 'ShowWatermark(evt, null, null)'";

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

            styleSheet.Apply(nChartControl1.Document);

            // configure the control to generate SVG.
            NImageResponse  imageResponse  = new NImageResponse();
            NSvgImageFormat svgImageFormat = new NSvgImageFormat();

            svgImageFormat.EnableInteractivity = true;
            svgImageFormat.CustomScript        = GetScript();
            svgImageFormat.EmbedImagesInSvg    = true;
            svgImageFormat.EmbeddedImageFormat = new NJpegImageFormat();

            Hashtable attributes = new Hashtable();

            attributes["preserveAspectRatio"] = "yMid slice";
//			attributes["onload"] = "Initialize(evt)";
            svgImageFormat.Attributes = attributes;
            imageResponse.ImageFormat = svgImageFormat;

            nChartControl1.ServerSettings.BrowserResponseSettings.DefaultResponse = imageResponse;
        }
        public override void Initialize(NThinChartControl control)
        {
            // enable jittering (full scene antialiasing)
            control.BackgroundStyle.FrameStyle.Visible = false;
            control.Settings.JitterMode = JitterMode.Enabled;

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

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

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

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

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

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

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

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

            ordinalScale.AutoLabels = false;

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

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

            styleSheet.Apply(chart);

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

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

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

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

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

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

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

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

            control.Controller.Tools.Clear();

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

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

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

            // add a cursor change tool
            control.Controller.Tools.Add(new NCursorTool());
        }
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Polar Area");

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

            // setup chart
            NPolarChart chart = new NPolarChart();

            nChartControl1.Charts.Clear();
            nChartControl1.Charts.Add(chart);
            chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal);
            chart.DisplayOnLegend = nChartControl1.Legends[0];
            chart.Width           = 70.0f;
            chart.Height          = 70.0f;
            chart.Depth           = 5;

            // setup polar axis
            NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.Polar).ScaleConfigurator;

            linearScale.RoundToTickMax = true;
            linearScale.RoundToTickMin = true;
            linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Polar, true);

            NScaleStripStyle strip = new NScaleStripStyle();

            strip.FillStyle  = new NColorFillStyle(Color.FromArgb(125, Color.Beige));
            strip.Interlaced = true;
            strip.SetShowAtWall(ChartWallType.Polar, true);
            linearScale.StripStyles.Add(strip);

            // setup polar angle axis
            NAngularScaleConfigurator angularScale = (NAngularScaleConfigurator)chart.Axis(StandardAxis.PolarAngle).ScaleConfigurator;

            angularScale.MajorGridStyle.SetShowAtWall(ChartWallType.Polar, true);
            strip            = new NScaleStripStyle();
            strip.FillStyle  = new NColorFillStyle(Color.FromArgb(125, 192, 192, 192));
            strip.Interlaced = true;
            strip.SetShowAtWall(ChartWallType.Polar, true);
            angularScale.StripStyles.Add(strip);

            // polar area series 1
            NPolarAreaSeries series1 = new NPolarAreaSeries();

            chart.Series.Add(series1);
            series1.Name = "Theoretical";
            series1.DataLabelStyle.Visible = false;
            GenerateData(series1, 100, 15.0);

            // polar area series 2
            NPolarAreaSeries series2 = new NPolarAreaSeries();

            chart.Series.Add(series2);
            series2.Name = "Experimental";
            series2.DataLabelStyle.Visible = false;
            GenerateData(series2, 100, 10.0);

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

            styleSheet.Apply(nChartControl1.Document);

            // init form controls
            RadianAngleStepComboBox.Items.Add("15");
            RadianAngleStepComboBox.Items.Add("30");
            RadianAngleStepComboBox.Items.Add("45");
            RadianAngleStepComboBox.Items.Add("90");
            RadianAngleStepComboBox.SelectedIndex = 0;
            BeginAngleScrollBar.Value             = 0.0f;
        }
        public override void Initialize()
        {
            base.Initialize();

            // set a chart title
            NLabel title = new NLabel("DateTime Smooth Line");

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

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

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

            chart.BoundsMode = BoundsMode.Stretch;

            NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator();

            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale;
            dateTimeScale.LabelValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.Date);
            dateTimeScale.LabelGenerationMode = LabelGenerationMode.Stagger2;

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

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

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

            // add the line
            NSmoothLineSeries line = (NSmoothLineSeries)chart.Series.Add(SeriesType.SmoothLine);

            line.Name                           = "Smooth Line";
            line.InflateMargins                 = true;
            line.Legend.Mode                    = SeriesLegendMode.Series;
            line.DataLabelStyle.Visible         = false;
            line.MarkerStyle.Visible            = true;
            line.MarkerStyle.PointShape         = PointShape.Cylinder;
            line.MarkerStyle.AutoDepth          = false;
            line.MarkerStyle.Width              = new NLength(1.4f, NRelativeUnit.ParentPercentage);
            line.MarkerStyle.Height             = new NLength(1.4f, NRelativeUnit.ParentPercentage);
            line.MarkerStyle.Depth              = new NLength(1.4f, NRelativeUnit.ParentPercentage);
            line.UseXValues                     = true;
            line.UseZValues                     = false;
            line.Use1DInterpolationForXYScatter = true;

            checkShowMarkers.Checked = true;
            checkRoundToTick.Checked = true;

            GenerateYValues(nValuesCount);
            GenerateXValues(nValuesCount);

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

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

            styleSheet.Apply(nChartControl1.Document);
        }