|
Group: Forum Members
Posts: 61,
Visits: 35
|
Hi,
This is my constructor, where I set up the scroll and zoom as well:
NDataZoomTool m_DataZoomTool = new NDataZoomTool();
this.nChartControl1 = nChartControl1;
#region chart set up
// configure the chart m_Chart = (NCartesianChart)nChartControl1.Charts[0];
// add interlaced stripe to the Y axis NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; ((NStandardScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator).StripStyles.Add(stripStyle); m_Chart.Location = new NPointL(new NLength(0, NRelativeUnit.ParentPercentage), new NLength(5, NRelativeUnit.ParentPercentage)); m_Chart.Size = new NSizeL(new NLength(100, NRelativeUnit.ParentPercentage), new NLength(95, NRelativeUnit.ParentPercentage));
NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0]; NRangeSelection rangeSelection = new NRangeSelection(); rangeSelection.ZoomOutResetsAxis = true; chart.RangeSelections.Add(rangeSelection); chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true; chart.Axis(StandardAxis.PrimaryY).ScrollBar.Visible = true;
//set up axis X NAxis axiss = m_Chart.Axis(StandardAxis.PrimaryX); NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); dateTimeScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; dateTimeScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); dateTimeScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, false); dateTimeScale.InnerMajorTickStyle.Length = new NLength(0); dateTimeScale.MaxTickCount = 5; dateTimeScale.MajorTickMode = MajorTickMode.AutoMaxCount; dateTimeScale.AutoDateTimeUnits = new NDateTimeUnit[] { NDateTimeUnit.Second }; dateTimeScale.RoundToTickMin = false; dateTimeScale.RoundToTickMax = false; dateTimeScale.EnableUnitSensitiveFormatting = false; dateTimeScale.LabelValueFormatter = new NDateTimeValueFormatter("dd-MMM-yy \r\n hh:mm:ss"); //DateTimeValueFormat.Year2Digit, DateTimeValueFormat.Year2Digit dateTimeScale.LabelStyle.TextStyle = new NTextStyle(new Font("Verdana", 8), Color.Black); axiss.ScaleConfigurator = dateTimeScale;
nChartControl1.Settings.AnimationInterval = 50; m_DataZoomTool.AnimateZooming = true; m_DataZoomTool.AnimationSteps = 10;
nChartControl1.Controller.Tools.Add(m_DataZoomTool);
nChartControl1.Controller.Selection.Add(chart); nChartControl1.Controller.Tools.Add(new NAxisScrollTool()); nChartControl1.Controller.Tools.Add(new NDataZoomTool());
#endregion
|