Recent

Author Topic: DatetimeIntervalChartSource showing labels at the beginning of a month  (Read 3444 times)

wp

  • Hero Member
  • *****
  • Posts: 7545
Is there a way to force the DateTimeIntervalChartSource such that it always creates axis labels at the first of each month? This means, in particular, that the distance between labels would vary according to the days per month.

Is this possible with the DateTimeIntervalChartSource, or do I have to use a ListSource (which would not be so fine for zooming)?

Two more questions:
  • What is the meaning of the Steps options?
  • When I change the DateTimeFormat the axis is not updated immediately at design time; I have to resize the form a bit (chart is client-aligned) to force a repaint.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: DatetimeIntervalChartSource showing labels at the beginning of a month
« Reply #1 on: November 25, 2012, 01:59:25 am »
Quote
the distance between labels would vary according to the days per month.
Sure, it should work like this by default.

wp

  • Hero Member
  • *****
  • Posts: 7545
Re: DatetimeIntervalChartSource showing labels at the beginning of a month
« Reply #2 on: November 25, 2012, 11:52:35 am »
But how do I get it to set marks at the beginning of each month? See attached project - I must be missing something...
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: DatetimeIntervalChartSource showing labels at the beginning of a month
« Reply #3 on: November 26, 2012, 07:36:30 am »
Quote
What is the meaning of the Steps options?
They represent basic steps to consider for the axis.
Algorithm goes roughly like this:
1) Consider a set of possible step values
{ v: v = s * n * 10^p, s in Steps, n in NiceSteps, n >= 1.0, p >= 0 }
2) From that set, select values which are allowed by limits in Params property
3) Is there are several of thouse, take the one which gives interval count closest to the Params.Count
4) Is there are several of (maximum two) values, take largest one.

Quote
When I change the DateTimeFormat the axis is not updated immediately at design time
Fixed in r39377

Quote
how do I get it to set marks at the beginning of each month?
According to the algorithm above,
TAChart determined that 10 days step is preferable to month.  You can: set RandomChartSource1.XMax = 40460, increase DateTimeIntervalChartSource1.Params.MinLength and/or MaxLength, exclude dtsDay from Steps, or perform another similar change to see month-sized intervals.

Additionally, TAChart have selected end-of-month instead of start-of month date, which is fixed in r39376.

wp

  • Hero Member
  • *****
  • Posts: 7545
Re: DatetimeIntervalChartSource showing labels at the beginning of a month
« Reply #4 on: November 26, 2012, 06:00:48 pm »
Thanks. Like with the logarithmic axis it's still hard to find settings that work for "all" chart sizes and zoom levels.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

 

TinyPortal © 2005-2018