xtpChartScaleDateTime with Zoom |
Post Reply |
Author | |
Andrew666
Groupie Joined: 15 October 2008 Status: Offline Points: 27 |
Post Options
Thanks(0)
Posted: 03 April 2011 at 3:27pm |
If the ArgumentScaleType = xtpChartScaleDateTime and the chart zoom is applied, dates are always displayed and never times. This means that when you zoom to less than one day in axis range, you just get the date repeated multiple times at the major tick points. Not much use.
Is there a way to display time as well as date in these circumstances? Thanks. Here's a screen shot illustrating the issue: |
|
mimue
Newbie Joined: 22 September 2008 Location: Germany Status: Offline Points: 3 |
Post Options
Thanks(0)
|
I have done this with a workaround. I use the CustomLabels. The sample sets the timelabels every 15 minutes.
Dim DateTimeMin As Date, DateTimeMax As Date, DateTimeAkt As Date DateTimeMin = [Min-DateTime of ChartSeries] DateTimeMax = [Max-DateTime of ChartSeries] DateTimeAkt = CDate(Int((CDbl(DateTimeMin) * 96) + 0.5) / 96) Diagram.AxisX.CustomLabels.Add Format(DateTimeAkt, "h:nn"), DateTimeAkt Do Until DateTimeAkt > DateTimeMax DateTimeAkt = DateTimeAkt + TimeSerial(0, 15, 0) Diagram.AxisX.CustomLabels.Add Format(DateTimeAkt, "h:nn"), DateTimeAkt Loop |
|
Product: Xtreme SuitePro (ActiveX) version 15.0.1
Platform: Windows 7 (x64) Language: Visual Basic 6.0 |
|
Andrew666
Groupie Joined: 15 October 2008 Status: Offline Points: 27 |
Post Options
Thanks(0)
|
Thanks for that - but it appears that every time the zoom changes I'd have to re-calculate this for the label periods to fit properly? Looks like your solution would be fine on a fixed (no zoom allowed) axis though - thanks.
|
|
mimue
Newbie Joined: 22 September 2008 Location: Germany Status: Offline Points: 3 |
Post Options
Thanks(0)
|
I use the zoom too, it works. Perhaps the rest of the code helps:
Dim DateTimeMin As Date, DateTimeMax As Date, DateTimeAkt As Date Dim Style As New ChartLineSeriesStyle Dim Series As ChartSeries If ChartControl.Content.Series.count > 0 Then ChartControl.Content.Series.DeleteAll End If Set Series = ChartControl.Content.Series.Add("") Series.ArgumentScaleType = xtpChartScaleDateTime Set Series = ChartControl.Content.Series.Add("") Series.ArgumentScaleType = xtpChartScaleDateTime 'Fill Series DateTimeMin = [Min-DateTime of ChartSeries] DateTimeMax = [Max-DateTime of ChartSeries] '----> Do '----> Series.Points.Add CDate(chartArgument), chartValue '----> Loop 'Set Style and some settings Set Series.Style = Style Style.Label.visible = False Style.Marker.Size = 5 Style.Marker.visible = True Set Diagram = ChartControl.Content.Diagrams(0) With Diagram .AllowScroll = True .AllowZoom = True With .AxisX With .Range .AutoRange = True .ViewAutoRange = True End With End With With .AxisY .AllowZoom = False With .Range .AutoRange = True .ViewAutoRange = True End With End With End With 'CustomLabels DateTimeAkt = CDate(Int((CDbl(DateTimeMin) * 96) + 0.5) / 96) Diagram.AxisX.CustomLabels.Add Format(DateTimeAkt, "h:nn"), DateTimeAkt Do Until DateTimeAkt > DateTimeMax DateTimeAkt = DateTimeAkt + TimeSerial(0, 15, 0) Diagram.AxisX.CustomLabels.Add Format(DateTimeAkt, "h:nn"), DateTimeAkt Loop |
|
Product: Xtreme SuitePro (ActiveX) version 15.0.1
Platform: Windows 7 (x64) Language: Visual Basic 6.0 |
|
Andrew666
Groupie Joined: 15 October 2008 Status: Offline Points: 27 |
Post Options
Thanks(0)
|
Interesting - I'll give that a try - thanks for taking the time to do the complete post.
|
|
Andrew666
Groupie Joined: 15 October 2008 Status: Offline Points: 27 |
Post Options
Thanks(0)
|
That appears to give me a fixed set of X-axis labels, 15 minutes apart. This means that if the period is over a number of days I get hundreds of labels, which are increasingly removed as I zoom in, until eventually I can read them. Unfortunately the Chart control has no Zoom-related events, so I can't dynamically change this
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |