pChart 2.x forum
http://wiki.pchart.net/forum/

pScatterTimeline
http://wiki.pchart.net/forum/viewtopic.php?f=4&t=2214
Page 1 of 1

Author:  onnerby [ Fri Oct 21, 2011 6:37 pm ]
Post subject:  pScatterTimeline

Hi all!

I had the need for a timeline in a scatter chart in one of projects, so I made this:
Image

So instead of creating a pScatter, create a pScatterTimeline and do the same with the chart. After "drawScatterScale()" just call "drawScatterTimeline()".
This of course assumes that the xAxis is using unixtime for values.
Options:
'border' = Color and weight of the border surrounding the timeline cells.
'row1' = Color of the first row of the timeline
'row2' = Color of the second row of the timeline
'rowtext1' and 'rowtext2' = Color of the text.
'levels' = This is an array of the different kind of levels that exists. Each level needs
  • 'period' formated for the DateInterval class
  • 'format' A date-format used to round the date to first offset
  • 'outputFormat' How to show the text
  • 'outputfullFormat' Last lines output text
  • 'avgDuration' This is a way to quickly calculate if the level match the chart.
When you add options to drawScatterScale you only need to supply the changed options.

This example will only change the output format for weeks.
Code:
$scatterChart->drawScatterTimeline(array(
   'levels' => array(
      3=>array('outputFormat'=>'v.W',), // level 3 is "week"
   ),
));

The timeline will automatically decide the interval of the timeline (minutes, hour, day, week, month or year)



Update: Timeline calculated wrong date. Sorry. Version 0.1 released and also adding options.

Attachments:
pScatterTimeline.v0.1.zip [1.68 KiB]
Downloaded 936 times

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/