Recommended Posts

Just starting with FusionCharts so bear with me. I've set up the example charts and all works fine. Now I want to pull data from a SQL database. I thought this would be easier now that SQL can output JSON data. However, so far I've not been able to make it work.

In the example on the homepage, for asp.net, the JSON data looks like this:

"{\n  \"chart\": {\n    \"caption\":

When I use a SQL query returning JSON and not a data set I get:

"\"chart\": { \"caption\":

My SQL statement:
SELECT TOP 1000 Topping, CAST(Slices as varchar(10)) as Slices
FROM dbo.tblPizza
FOR JSON PATH;

So, two questions:
a. Can we use SQL's output of JSON data? If so how?
b. If "a" isn't possible, how can I get all those "\n"'s in the right places to make the database output work?

I've uploaded a file that shows more of the above strings from the FusionChart homepage example and what I get from SQL.

Thanks for you help.

FusionChart_Comparison.txt

Share this post


Link to post
Share on other sites

Hi,

Thanks for getting in touch.

You need to write data access methodology for accessing data from the underline database and after fetching data you need to convert it in prescribed JSON or XML format for rendering the supported chart.

For further reference please check our tutorial link showcasing how data from SQL database could be fetched and render FusionCharts supported chart https://www.fusioncharts.com/blog/creating-fusioncharts-drill-down-charts-from-database-using-entity-framework-and-linq-in-visual-studio/

Hope this would help.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now