Exemplo n.º 1
0
        private void ShapeCombo_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            NRangeSeries rangeSeries = (NRangeSeries)nChartControl1.Charts[0].Series[0];

            rangeSeries.Shape = (BarShape)ShapeCombo.SelectedIndex;
            nChartControl1.Refresh();
        }
Exemplo n.º 2
0
        public override void Initialize()
        {
            base.Initialize();

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

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

            NChart chart = nChartControl1.Charts[0];

            chart.BoundsMode = BoundsMode.Stretch;

            // create the heat map (will be updated on timer tick)
            m_HeatMap = new NHeatMapSeries();
            m_HeatMap.Data.SetGridSize(m_SizeX, m_SizeY);
            m_HeatMap.Data.SetValues(double.NaN);
            m_HeatMap.Legend.Mode = SeriesLegendMode.SeriesLogic;             // used to display palette information
            m_HeatMap.Legend.PaletteLegendMode    = PaletteLegendMode.GradientAxis;
            m_HeatMap.Legend.PaletteScaleStepMode = PaletteScaleStepMode.SynchronizeWithScaleConfigurator;
            m_HeatMap.Legend.PaletteLength        = new NLength(400);

            NNumericScaleConfigurator numericScale = m_HeatMap.Legend.PaletteScaleConfigurator as NNumericScaleConfigurator;

            numericScale.MajorTickMode = MajorTickMode.CustomStep;
            numericScale.CustomStep    = 10;

            m_HeatMap.Palette.Mode          = PaletteMode.AutoMinMaxColor;
            m_HeatMap.Palette.PositiveColor = Color.FromArgb(125, Color.Red);
            m_HeatMap.Palette.ZeroColor     = Color.FromArgb(125, Color.Blue);
            m_HeatMap.Palette.SmoothPalette = true;

            chart.Series.Add(m_HeatMap);

            // add background image
            NRangeSeries range = new NRangeSeries();

            range.UseXValues             = true;
            range.DataLabelStyle.Visible = false;
            range.Legend.Mode            = SeriesLegendMode.None;

            range.Values.Add(0);
            range.Y2Values.Add(m_SizeY);

            range.XValues.Add(0);
            range.X2Values.Add(m_SizeX);

            Bitmap bitmap = NResourceHelper.BitmapFromResource(this.GetType(), "USMap.png", "Nevron.Examples.Chart.WinForm.Resources");

            range.FillStyle = new NImageFillStyle(bitmap);
            chart.Series.Add(range);

            timer1.Interval = 100;
            timer1.Start();

            ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]);
        }
Exemplo n.º 3
0
 private void AddDataPoint(NRangeSeries series, double x1, double x2, double y1, double y2, double z1, double z2)
 {
     series.XValues.Add(x1);
     series.X2Values.Add(x2);
     series.Values.Add(y1);
     series.Y2Values.Add(y2);
     series.ZValues.Add(z1);
     series.Z2Values.Add(z2);
 }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = new NLabel("2D Range Series");

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

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

            chart.BoundsMode = BoundsMode.Stretch;

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

            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.InnerMajorTickStyle.Visible      = false;

            // setup 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;
            linearScale.InnerMajorTickStyle.Visible      = false;

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

            // setup shape series
            NRangeSeries rangeSeries = (NRangeSeries)chart.Series.Add(SeriesType.Range);

            rangeSeries.DataLabelStyle.Visible = false;
            rangeSeries.UseXValues             = true;
            rangeSeries.FillStyle         = new NColorFillStyle(DarkOrange);
            rangeSeries.BorderStyle.Color = Color.DarkRed;

            // fill data
            FillData(rangeSeries);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
Exemplo n.º 5
0
        private static void FillData(NRangeSeries rangeSeries)
        {
            double[] arrIntervals = new double[] { 5, 5, 5, 5, 5, 5, 5, 5, 5, 15, 30, 60 };
            double[] arrValues    = new double[] { 4180, 13687, 18618, 19634, 17981, 7190, 16369, 3212, 4122, 9200, 6461, 3435 };

            int    count = Math.Min(arrIntervals.Length, arrValues.Length);
            double x     = 0;

            for (int i = 0; i < count; i++)
            {
                double dInterval = arrIntervals[i];
                double dValue    = arrValues[i];

                rangeSeries.Values.Add(0);
                rangeSeries.XValues.Add(x);

                x += dInterval;

                rangeSeries.Y2Values.Add(dValue / dInterval);
                rangeSeries.X2Values.Add(x);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Standard Range";

            // configure chart
            m_Chart = (NCartesianChart)chartView.Surface.Charts[0];

            m_Chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear);

            // setup X axis
            NLinearScale xScale = (NLinearScale)m_Chart.Axes[ENCartesianAxis.PrimaryX].Scale;

            xScale.MajorGridLines.Visible = true;

            // setup Y axis
            NLinearScale yScale = (NLinearScale)m_Chart.Axes[ENCartesianAxis.PrimaryY].Scale;

            yScale.MajorGridLines.Visible = true;

            // add interlaced stripe
            NScaleStrip strip = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);

            strip.Interlaced = true;
            yScale.Strips.Add(strip);

            // setup shape series
            m_Range = new NRangeSeries();
            m_Chart.Series.Add(m_Range);

            m_Range.DataLabelStyle = new NDataLabelStyle(false);
            m_Range.UseXValues     = true;
            m_Range.Fill           = new NColorFill(NColor.DarkOrange);
            m_Range.Stroke         = new NStroke(NColor.DarkRed);

            // fill data
            double[] intervals = new double[] { 5, 5, 5, 5, 5, 5, 5, 5, 5, 15, 30, 60 };
            double[] values    = new double[] { 4180, 13687, 18618, 19634, 17981, 7190, 16369, 3212, 4122, 9200, 6461, 3435 };

            int    count = Math.Min(intervals.Length, values.Length);
            double x     = 0;

            for (int i = 0; i < count; i++)
            {
                double interval = intervals[i];
                double value    = values[i];

                double x1 = x;
                double y1 = 0;

                x += interval;
                double x2 = x;
                double y2 = value / interval;

                m_Range.DataPoints.Add(new NRangeDataPoint(x1, y1, x2, y2));
            }

            chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, false));

            return(chartView);
        }
Exemplo n.º 7
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Weekly Schedule Work Calendar";

            // configure chart
            m_Chart = (NCartesianChart)chartView.Surface.Charts[0];
            m_Chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear);

            NRangeSeries ranges = new NRangeSeries();

            m_Chart.Series.Add(ranges);

            ranges.DataLabelStyle = new NDataLabelStyle(false);
            ranges.UseXValues     = true;

            DateTime dt   = new DateTime(2014, 4, 14);
            Random   rand = new Random();

            NRangeTimelineScale rangeTimeline = new NRangeTimelineScale();

            rangeTimeline.EnableCalendar = true;
            m_Chart.Axes[ENCartesianAxis.PrimaryX].Scale = rangeTimeline;

            NLinearScale yScale = (NLinearScale)m_Chart.Axes[ENCartesianAxis.PrimaryY].Scale;

            yScale.MajorGridLines.Visible = true;

            // add interlaced strip
            NScaleStrip strip = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);

            strip.Interlaced = true;
            yScale.Strips.Add(strip);

            yScale.Title.Text = "Weekly Workload in %";

            NWorkCalendar workCalendar = rangeTimeline.Calendar;

            // show only the working days on the scale
            NWeekDayRule weekDayRule = new NWeekDayRule(ENWeekDayBit.Monday | ENWeekDayBit.Tuesday | ENWeekDayBit.Wednesday | ENWeekDayBit.Thursday | ENWeekDayBit.Friday);

            workCalendar.Rules.Add(weekDayRule);

            // generate data for week working days
            for (int i = 0; i < 21; i++)
            {
                if (dt.DayOfWeek != DayOfWeek.Saturday && dt.DayOfWeek != DayOfWeek.Sunday)
                {
                    ranges.DataPoints.Add(new NRangeDataPoint(NDateTimeHelpers.ToOADate(dt), 0, NDateTimeHelpers.ToOADate(dt + new TimeSpan(1, 0, 0, 0)), rand.NextDouble() * 70 + 30.0d));
                }

                dt += new TimeSpan(1, 0, 0, 0);
            }

            ConfigureInteractivity(m_Chart);

            chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, false));

            return(chartView);
        }
Exemplo n.º 8
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 = new NLabel("3D Range Series");

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

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

            chart.Enable3D             = true;
            chart.Projection.Type      = ProjectionType.Perspective;
            chart.Projection.Rotation  = -18;
            chart.Projection.Elevation = 13;
            chart.Depth  = 55.0f;
            chart.Width  = 55.0f;
            chart.Height = 55.0f;

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

            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MajorGridStyle.LineStyle.Pattern        = LinePattern.Dot;
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale;
            chart.Axis(StandardAxis.PrimaryX).View = new NRangeAxisView(new NRange1DD(0, 20), true, true);

            // setup Y axis
            linearScale = new NLinearScaleConfigurator();
            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);

            chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale;
            chart.Axis(StandardAxis.PrimaryY).View = new NRangeAxisView(new NRange1DD(0, 20), true, true);

            // setup Depth axis
            linearScale = new NLinearScaleConfigurator();
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MajorGridStyle.LineStyle.Pattern     = LinePattern.Dot;
            chart.Axis(StandardAxis.Depth).ScaleConfigurator = linearScale;
            chart.Axis(StandardAxis.Depth).View = new NRangeAxisView(new NRange1DD(0, 20), true, true);

            // setup shape series
            NRangeSeries rangeSeries = (NRangeSeries)chart.Series.Add(SeriesType.Range);

            rangeSeries.FillStyle              = new NColorFillStyle(Color.Red);
            rangeSeries.BorderStyle.Color      = Color.DarkRed;
            rangeSeries.Legend.Mode            = SeriesLegendMode.None;
            rangeSeries.DataLabelStyle.Visible = false;
            rangeSeries.UseXValues             = true;
            rangeSeries.UseZValues             = true;

            // add data
            AddDataPoint(rangeSeries, 1, 5, 11, 17, 5, 9);
            AddDataPoint(rangeSeries, 4, 7, 15, 19, 16, 19);
            AddDataPoint(rangeSeries, 5, 15, 6, 11, 12, 18);
            AddDataPoint(rangeSeries, 9, 14, 2, 5, 3, 5);
            AddDataPoint(rangeSeries, 15, 19, 2, 5, 3, 5);

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

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

            styleSheet.Apply(nChartControl1.Document);
        }
Exemplo n.º 9
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("Heat Map");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            title.TextStyle.FillStyle        = new NColorFillStyle(GreyBlue);
            title.DockMode = PanelDockMode.Top;
            title.Margins  = new NMarginsL(0, 5, 0, 0);
            nChartControl1.Panels.Add(title);

            NLegend legend = new NLegend();

            legend.DockMode     = PanelDockMode.Right;
            legend.Margins      = new NMarginsL(0, 5, 5, 0);
            legend.FitAlignment = ContentAlignment.TopCenter;
            nChartControl1.Panels.Add(legend);

            NCartesianChart chart = new NCartesianChart();

            nChartControl1.Panels.Add(chart);

            chart.DisplayOnLegend = legend;
            chart.DockMode        = PanelDockMode.Fill;
            chart.BoundsMode      = BoundsMode.Stretch;
            chart.Margins         = new NMarginsL(5);

            // create the heat map (will be updated on timer tick)
            NHeatMapSeries heatMap = new NHeatMapSeries();

            heatMap.Data.SetGridSize(m_SizeX, m_SizeY);
            heatMap.Data.SetValues(double.NaN);
            heatMap.Legend.Mode = SeriesLegendMode.SeriesLogic;             // used to display palette information
            heatMap.Legend.PaletteLegendMode    = PaletteLegendMode.GradientAxis;
            heatMap.Legend.PaletteScaleStepMode = PaletteScaleStepMode.SynchronizeWithScaleConfigurator;
            heatMap.Legend.PaletteLength        = new NLength(170);

            NNumericScaleConfigurator numericScale = heatMap.Legend.PaletteScaleConfigurator as NNumericScaleConfigurator;

            numericScale.MajorTickMode = MajorTickMode.CustomStep;
            numericScale.CustomStep    = 10;

            heatMap.Palette.Mode          = PaletteMode.AutoMinMaxColor;
            heatMap.Palette.PositiveColor = Color.FromArgb(125, Color.Red);
            heatMap.Palette.ZeroColor     = Color.FromArgb(125, Color.Blue);
            heatMap.Palette.SmoothPalette = true;

            chart.Series.Add(heatMap);

            // add background image
            NRangeSeries range = new NRangeSeries();

            range.UseXValues             = true;
            range.DataLabelStyle.Visible = false;
            range.Legend.Mode            = SeriesLegendMode.None;

            range.Values.Add(0);
            range.Y2Values.Add(m_SizeY);

            range.XValues.Add(0);
            range.X2Values.Add(m_SizeX);

            Bitmap bitmap = new Bitmap(this.MapPathSecure(this.TemplateSourceDirectory + "/USMap.png"));

            range.FillStyle = new NImageFillStyle(bitmap);
            chart.Series.Add(range);

            // then create some dummy data
            CreateDymmyData(heatMap);
        }
Exemplo n.º 10
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Daily Schedule Work Calendar";

            // configure chart
            m_Chart = (NCartesianChart)chartView.Surface.Charts[0];
            m_Chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear);

            NRangeSeries ranges = new NRangeSeries();

            m_Chart.Series.Add(ranges);

            ranges.DataLabelStyle = new NDataLabelStyle(false);
            ranges.UseXValues     = true;

            DateTime dt   = new DateTime(2014, 4, 14);
            Random   rand = new Random();

            NRangeTimelineScale rangeTimeline = new NRangeTimelineScale();

            rangeTimeline.EnableCalendar                 = true;
            rangeTimeline.InflateViewRangeEnd            = false;
            rangeTimeline.InflateViewRangeBegin          = false;
            m_Chart.Axes[ENCartesianAxis.PrimaryX].Scale = rangeTimeline;

            NLinearScale yScale = (NLinearScale)m_Chart.Axes[ENCartesianAxis.PrimaryY].Scale;

            yScale.MajorGridLines.Visible = true;

            // add interlaced strip
            NScaleStrip strip = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);

            strip.Interlaced = true;
            yScale.Strips.Add(strip);

            yScale.Title.Text = "Daily Workload in %";

            NWorkCalendar      workCalendar      = rangeTimeline.Calendar;
            NDateTimeRangeRule dateTimeRangeRule = null;

            for (int i = 0; i < 120; i++)
            {
                int hourOfTheDay = i % 24;

                if (hourOfTheDay < 8 || hourOfTheDay > 18)
                {
                    DateTime curDate = new DateTime(dt.Year, dt.Month, dt.Day, 0, 0, 0);

                    if (dateTimeRangeRule != null)
                    {
                        if (dateTimeRangeRule.Range.Begin != curDate)
                        {
                            dateTimeRangeRule = null;
                        }
                    }

                    if (dateTimeRangeRule == null)
                    {
                        dateTimeRangeRule = new NDateTimeRangeRule(new NDateTimeRange(curDate, curDate + new TimeSpan(24, 0, 0)), true);
                        workCalendar.Rules.Add(dateTimeRangeRule);
                    }

                    dateTimeRangeRule.Schedule.SetHourRange(dt.Hour, dt.Hour + 1, true);
                }
                else
                {
                    ranges.DataPoints.Add(new NRangeDataPoint(NDateTimeHelpers.ToOADate(dt), 0, NDateTimeHelpers.ToOADate(dt + new TimeSpan(1, 0, 0)), rand.NextDouble() * 70 + 30.0d));
                }

                dt += new TimeSpan(1, 0, 0);
            }

            ConfigureInteractivity(m_Chart);

            chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, false));

            return(chartView);
        }
        public override void Initialize()
        {
            base.Initialize();

            // set a chart title
            NLabel title = new NLabel("Daily Workload in Percents<br/><font size = '9pt'>Demonstrates how to skip hours in the working days, per day using the daily schedule object</font>");

            title.TextStyle.TextFormat = TextFormat.XML;
            title.TextStyle.FontStyle  = new NFontStyle("Times New Roman", 18, FontStyle.Italic);
            nChartControl1.Panels.Add(title);

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

            chart.BoundsMode = BoundsMode.Stretch;

            NRangeSelection rangeSelection = new NRangeSelection();

            rangeSelection.VerticalValueSnapper = new NAxisRulerMinMaxSnapper();
            chart.RangeSelections.Add(rangeSelection);
            chart.BoundsMode = BoundsMode.Stretch;

            NRangeSeries ranges = new NRangeSeries();

            ranges.DataLabelStyle.Visible = false;
            ranges.UseXValues             = true;

            DateTime dt   = new DateTime(2014, 4, 14);
            Random   rand = new Random();

            NRangeTimelineScaleConfigurator rangeTimeline = new NRangeTimelineScaleConfigurator();

            rangeTimeline.EnableCalendar = true;
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = rangeTimeline;
            chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true;

            chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator.Title.Text = "Daily Workload in %";
            chart.Axis(StandardAxis.PrimaryY).View = new NRangeAxisView(new NRange1DD(0, 100), true, true);

            NWorkCalendar      workCalendar      = rangeTimeline.Calendar;
            NDateTimeRangeRule dateTimeRangeRule = null;

            for (int i = 0; i < 120; i++)
            {
                int hourOfTheDay = i % 24;
                if (hourOfTheDay < 8 || hourOfTheDay > 18)
                {
                    DateTime curDate = new DateTime(dt.Year, dt.Month, dt.Day, 0, 0, 0);

                    if (dateTimeRangeRule != null)
                    {
                        if (dateTimeRangeRule.Range.Begin != curDate)
                        {
                            dateTimeRangeRule = null;
                        }
                    }

                    if (dateTimeRangeRule == null)
                    {
                        dateTimeRangeRule = new NDateTimeRangeRule(new NDateTimeRange(curDate, curDate + new TimeSpan(24, 0, 0)), true);
                        workCalendar.Rules.Add(dateTimeRangeRule);
                    }

                    dateTimeRangeRule.Schedule.SetHourRange(dt.Hour, dt.Hour + 1, true);
                }
                else
                {
                    ranges.Values.Add(0);
                    ranges.Y2Values.Add(rand.NextDouble() * 70 + 30.0d);
                    ranges.XValues.Add((dt + new TimeSpan(1, 0, 0)).ToOADate());
                    ranges.X2Values.Add(dt.ToOADate());
                }

                dt += new TimeSpan(1, 0, 0);
            }

            chart.Series.Add(ranges);

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

            nChartControl1.Controller.Tools.Add(new NSelectorTool());
            nChartControl1.Controller.Tools.Add(new NAxisScrollTool());
            nChartControl1.Controller.Tools.Add(new NDataZoomTool());
            nChartControl1.Controller.Tools.Add(new NDataPanTool());

            // init form controls
            EnableWorkCalendar.Checked = true;
        }
Exemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                WebExamplesUtilities.FillComboWithEnumValues(ShapeDropDownList, typeof(BarShape));
                ShapeDropDownList.SelectedIndex = 0;
            }

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

            // set a chart title
            NLabel title = new NLabel("3D Range Series");

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

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

            chart.Enable3D = true;
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
            chart.Projection.Type      = ProjectionType.Perspective;
            chart.Projection.Rotation  = -18;
            chart.Projection.Elevation = 13;
            chart.Depth  = 55.0f;
            chart.Width  = 55.0f;
            chart.Height = 55.0f;

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

            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MajorGridStyle.LineStyle.Pattern        = LinePattern.Dot;
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale;
            chart.Axis(StandardAxis.PrimaryX).View = new NRangeAxisView(new NRange1DD(0, 20), true, true);

            // setup Y axis
            linearScale = new NLinearScaleConfigurator();
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.MajorGridStyle.LineStyle.Pattern        = LinePattern.Dot;
            chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale;
            chart.Axis(StandardAxis.PrimaryY).View = new NRangeAxisView(new NRange1DD(0, 20), true, true);

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

            // setup Depth axis
            linearScale = new NLinearScaleConfigurator();
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MajorGridStyle.LineStyle.Pattern     = LinePattern.Dot;
            chart.Axis(StandardAxis.Depth).ScaleConfigurator = linearScale;
            chart.Axis(StandardAxis.Depth).View = new NRangeAxisView(new NRange1DD(0, 20), true, true);

            // setup shape series
            NRangeSeries rangeSeries = (NRangeSeries)chart.Series.Add(SeriesType.Range);

            rangeSeries.FillStyle              = new NColorFillStyle(Color.Red);
            rangeSeries.BorderStyle.Color      = Color.DarkRed;
            rangeSeries.Legend.Mode            = SeriesLegendMode.None;
            rangeSeries.DataLabelStyle.Visible = false;
            rangeSeries.UseXValues             = true;
            rangeSeries.UseZValues             = true;
            rangeSeries.Shape = (BarShape)ShapeDropDownList.SelectedIndex;

            // add data
            AddDataPoint(rangeSeries, 1, 5, 11, 17, 5, 9);
            AddDataPoint(rangeSeries, 4, 7, 15, 19, 16, 19);
            AddDataPoint(rangeSeries, 5, 15, 6, 11, 12, 18);
            AddDataPoint(rangeSeries, 9, 14, 2, 5, 3, 5);
            AddDataPoint(rangeSeries, 15, 19, 2, 5, 3, 5);

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

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

            styleSheet.Apply(nChartControl1.Document);
        }