Group: Forum Members
Last Active: 3 Years Ago
Posts: 0,
Visits: 78
|
I am using a NRangeTimelineScaleConfigurator object to configure the X axis of a chart. I am plotting data that is dated from 1976 through 2007. When I plot OHLC data with this data set, the X axis is correctly set to the date range of my data set -- 1976 to 2007. However, when I plot an Area chart or a Line chart with this same data set, the display of the X axis starts at the year 1900. How do I tell the X axis to start at a given year (1976, in my case) when plotting an Area or Line chart? /// <summary> /// Set up the X axis chart a Cartesian chart. /// </summary> /// <param name="chart"> /// The Cartesian chart for which its X axis should be set up. /// </param> public void SetUpXAxis(NCartesianChart chart) { var xAxisConfigurator = new NRangeTimelineScaleConfigurator(); xAxisConfigurator.FirstRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; xAxisConfigurator.FirstRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(225, 225, 225)); xAxisConfigurator.FirstRow.UseGridStyle = true; xAxisConfigurator.SecondRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; xAxisConfigurator.SecondRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(215, 215, 215)); xAxisConfigurator.SecondRow.UseGridStyle = true; xAxisConfigurator.ThirdRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; xAxisConfigurator.ThirdRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(205, 205, 205)); xAxisConfigurator.ThirdRow.UseGridStyle = true; xAxisConfigurator.AutoDateTimeUnits = new NDateTimeUnit[] { NDateTimeUnit.Century, NDateTimeUnit.Decade, NDateTimeUnit.Year, NDateTimeUnit.Quarter, NDateTimeUnit.Month, NDateTimeUnit.Week, NDateTimeUnit.Day }; xAxisConfigurator.EnableCalendar = true; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = xAxisConfigurator;
chart.Axis(StandardAxis.PrimaryX).ScrollBar.ResetButton.Visible = false; chart.Axis(StandardAxis.PrimaryX).PagingView = new NNumericAxisPagingView(new NRange1DD(0, 20)); chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true; }
/// <summary>
/// Set up the X axis chart a Cartesian chart.
/// </summary>
/// <param name="chart">
/// The Cartesian chart for which its X axis should be set up.
/// </param>
public void SetUpXAxis(NCartesianChart chart)
{
var xAxisConfigurator = new NRangeTimelineScaleConfigurator();
xAxisConfigurator.FirstRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
xAxisConfigurator.FirstRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(225, 225, 225));
xAxisConfigurator.FirstRow.UseGridStyle = true;
xAxisConfigurator.SecondRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
xAxisConfigurator.SecondRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(215, 215, 215));
xAxisConfigurator.SecondRow.UseGridStyle = true;
xAxisConfigurator.ThirdRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
xAxisConfigurator.ThirdRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(205, 205, 205));
xAxisConfigurator.ThirdRow.UseGridStyle = true;
xAxisConfigurator.AutoDateTimeUnits = new NDateTimeUnit[]
{
NDateTimeUnit.Century,
NDateTimeUnit.Decade,
NDateTimeUnit.Year,
NDateTimeUnit.Quarter,
NDateTimeUnit.Month,
NDateTimeUnit.Week,
NDateTimeUnit.Day
};
xAxisConfigurator.EnableCalendar = true;
chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = xAxisConfigurator;
chart.Axis(StandardAxis.PrimaryX).ScrollBar.ResetButton.Visible = false;
chart.Axis(StandardAxis.PrimaryX).PagingView = new NNumericAxisPagingView(new NRange1DD(0, 20));
chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true;
}
|
Group: Forum Members
Last Active: Last Month
Posts: 3,055,
Visits: 4,052
|
Hi, Most likely the series Area/Line series is not configured to use X values - that's why they start from 0 value which corresponds to 1990 in the date-time format. To configure the series to use X values you can use: someSeries.UseXValues = true; then you need to provide the x values as well: someSeries.XValues.Add(someDateTime.ToOADate()); We hope this helps - let us know if you have any questions.
Best Regards, Nevron Support Team
|
Group: Forum Members
Last Active: 3 Years Ago
Posts: 0,
Visits: 78
|
Yes, it works now. I forgot to tell the area series to use the X values. Everything is now as expected. Thank you!
|