Group: Forum Members
Last Active: 6 Years Ago
Posts: 32,
Visits: 50
|
Hi, I have a question regarding the formatting of Date Values on the Primary X Axis of a line chart. The
My X and Y Axes has been configured as per examples (X = Date, Y = Currency) and the code snippet is:
' Configure the X Axis as a Date Scale Dim XAxisScale As NDateTimeScaleConfigurator = New NDateTimeScaleConfigurator() LineChart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = XAxisScale With XAxisScale .LabelStyle.Angle = New NScaleLabelAngle(ScaleLabelAngleMode.Scale, 270) .LabelStyle.ContentAlignment = ContentAlignment.MiddleLeft .LabelGenerationMode = LabelGenerationMode.SingleLevel .EnableUnitSensitiveFormatting = False .InflateContentRange = False End With
' Configure the Y Axis as a Numeric Scale Dim YAxisScale As NLinearScaleConfigurator = CType(LineChart.Axis(StandardAxis.PrimaryY).ScaleConfigurator, NLinearScaleConfigurator) With YAxisScale .LabelValueFormatter = New NNumericValueFormatter("£0") .MajorGridStyle.LineStyle.Pattern = LinePattern.Dot .MajorGridStyle.SetShowAtWall(ChartWallType.Back, True) .InflateContentRange = False End With
I then go fetch my data from my database and process the Date/Currency pairs into the chart:
For Each drTwelveWeek As dstQNIData.dtaTwelveWeekRow In dtTwelveWeek.Rows With drTwelveWeek BudgetData.Values.Add(.BUDGET) BudgetData.XValues.Add(.START) ActualData.Values.Add(.ACTUAL) ActualData.XValues.Add(.START) End With Next drTwelveWeek
The data all loads fine, and debug shows correct values coming in, but although my dates are in 2015, the values displayed in the labels on the X Axis are from 31/12/1899 onwards.
Also, I have an issue where the X Axis label is only displayed for every 7th "point" on the line whereas I need the date displayed at each tick.
I am sure I am doing something absolutely stupid here, but I have spent so long looking at this now I just am going code-blind. I cannot see what I have missed.
Many thanks, Steve
|