close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Dynamic Web Charts: Display 12 months

Thread began 12/12/2011 10:28 am by theorytl401135 | Last modified 7/02/2012 6:28 pm by Miguel | 1937 views | 1 replies |

theorytl401135

Dynamic Web Charts: Display 12 months

How can I add make a chart display dynamic data by month but with 12 months showing?

If I group my data by month now I get only the data that exist in my table but I would like the data to be shown specifically by the current year and all 12 months displaying even if there is no data.

I am using a time-stamp to mark my records.


Thanks

Sign in to reply to this post

Miguel

Hello theorytl401135, in order to do this you would need to do some hand code, go to the folder where the data parsers are of the charts that if you have the new version would be

domain/webassist/open_flash_charts/

Open in dreamweaver your data file something like:

chartname_data#.php where # is the number of the file and chartname_ is the name of your chart.
look for the recordset and add a where clause

example:

add this to the where you will add


php:
WHERE DateField >= '(DATE_SUB(NOW(), INTERVAL 1 YEAR))' AND DateField <= 'NOW()'

this will get the todays date and only show the last 12 month

another more complete example, this is how it comes out directly from the wizard

php:
$query_WADWCTable = "SELECT CONCAT( LEFT(MONTHNAME(dateField), 3), ' ', YEAR(dateField)) AS XLABEL, COUNT(idUsers) AS YVALUE 
FROM TABLENAME 
GROUP BY CONCAT( LEFT(MONTHNAME(dateField), 3), ' ', YEAR(dateField)), YEAR(dateField), MONTH(dateField) 
ORDER BY YEAR(dateField), MONTH(dateField) ASC";

so after the wizard finish i just add the where clause to the query

php:
$query_WADWCTable = "SELECT CONCAT( LEFT(MONTHNAME(dateField), 3), ' ', YEAR(dateField)) AS XLABEL, COUNT(idUsers) AS YVALUE 
FROM TABLENAME
WHERE  dateField>= '(DATE_SUB(NOW(), INTERVAL 1 YEAR))' AND dateField<= 'NOW()' 
GROUP BY CONCAT( LEFT(MONTHNAME(dateField), 3), ' ', YEAR(dateField)), YEAR(dateField), MONTH(dateField) 
ORDER BY YEAR(dateField), MONTH(dateField) ASC";

so again to make it more understandable we are using a function that exist in php library's called INTERVAL

INTERVAL 1 YEAR
INTERVAL 15 DAYS
INTERVAL 4 MONTH

You can combine it any way you want, and finally we are using the NOW()

NOW() = Gets the actual date on the server

The trick of this is creating a between dates set up manually this gets it dynamically

Hope this helps lets us know

Sades

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...