Menu Content

Support

> Forums, FAQs & Paid Support
Welcome, Guest
Username Password: Remember me

Unable to render chart
(1 viewing) (1) Guest
Flash chart component for Joomla CMS.

NOTE: This category has been locked. If you have purchased paid version, please, use our Support Ticket system instead. If you are using free edition, please see the Community Support section.
  • Page:
  • 1
  • 2

TOPIC: Unable to render chart

Re: Unable to render chart 11 years, 8 months ago #32253

Since it took me a while to figure this out and the documentation hasn't been great I figured I'd write a little primer on how generate the charts with SQL. This walks you through the logic - only the end query is valid.

In Excel, if you wanted to create say a pie chart you'd simply need to create a table like
Label: Value1
Lablel: Value 2
Label: Value 3

Alternatively, you could create a pie chart using:
Label, Label, Label
Value1, Value2, Value3

However, with FusionCharts for Joomla you need to also create values for certain chart parameters even if you don't plan on using them. So instead of a query like:

SELECT Field1 as Label1, Field2 as Label2 from TABLE
you need to actually specify the charts border color, border alpha and "is sliced". But since at this stage you just want to see what the chart looks like, you need to modify your code to look like:

SELECT 'blank', 'blank', 'blank', Field1 as Label1 from Table.
In this case 'blank' is actualy '' (two apostrophe's).

But you're not finished. For pie charts you cannot have mutliple categories, just multiple datasets. So this version of showing the data:
Label, Label, Label
Value1, Value2, Value3

Isn't valid, you need to show the data like:
Label: Value1
Lablel: Value 2
Label: Value 3


Which means you need to Join the table onto itself. UNION ALL is a good way to do this. Thus, your final result looks like:

Select '','','','Label1', Field1 from TABLE1
UNION ALL
Select '','','','Label2',Field2 from TABLE1
UNION ALL
Select '','','','Label2',Field3 from TABLE1

This will produce a pie-chart with the values from Field1, Field2 and Field3 from your table TABLE1

Cheers,

Steve
The topic has been locked.
  • Page:
  • 1
  • 2
User Login Empty