3 Replies - 1168 Views - Last Post: 18 July 2013 - 07:51 AM Rate Topic: -----

#1 Unohoo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 19-June 13

return coldfusion array in flot

Posted 22 June 2013 - 07:10 AM

I have a cfc that returns 3 arrays that I want to display on a flot bar chart. I thought it would be as simply as:
<cfscript>
// create component object
chartArrayVals = CreateObject("component", "myCFC.chartData");
</cfscript>

<cfset getArray1 = #charArrayVals.Array1# />
<cfset chart1 = serializejson(getArray1) />

<cfset getArray2 = #charArrayVals.Array2# />
<cfset chart2 = serializejson(getArray2) />

<cfset getArray3 = #charArrayVals.Array3# />
<cfset chart3 = serializejson(getArray3) />

<script>
<cfoutput>
     $.plot($("#placeholder"), [ {data:#chart1#},{data:#chart2#},{data:#chart3#}], 
        {
            bars:{show:true},
            points:{show:true}
        })
</cfoutput>
</script>


All I get is a blank div where the chart is suppose to be.

Is This A Good Question/Topic? 0
  • +

Replies To: return coldfusion array in flot

#2 Craig328  Icon User is offline

  • I make this look good
  • member icon

Reputation: 1919
  • View blog
  • Posts: 3,461
  • Joined: 13-January 08

Re: return coldfusion array in flot

Posted 25 June 2013 - 01:40 PM

Hello and welcome to DIC, Unohoo.

To start, please read this post for what we need to help you with your code issue(s). A description of "All I get is a blank div where the chart is suppose to be" and 23 lines of code isn't nearly enough for anyone to being adequately helping you to troubleshoot your issue.

What I'd need to know is: do you have any experience in developing with ColdFusion? I ask because the code you have here features a few concepts that are intermediate ones and it would appear that by not mentioning them, you may not be possessed of the skills to effectively work with this code. Further, the code snippet you posted shows a call to jQuery which, while it plays well with CF, isn't strictly a CF tech. There is a Coldfusion object that you've instantiated that likely contains the actual source of your problem IF it's an issue with CF that's causing it...but you haven't included that nor described your issue in terms of an actual error you've encountered nor what you've tried to identify or remedy it.

Please feel free to post back here with more material if you like and we can see what can be done to assist you. As it is now, there's nothing that can be done to even start to suggest what you might need to do.
Was This Post Helpful? 1
  • +
  • -

#3 FusionNinja  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 27-June 13

Re: return coldfusion array in flot

Posted 27 June 2013 - 06:43 PM

First, it might be sure to post your .cfc file. Are you returning this data from a database? as a array or as a query? If we are able to see your queries it might be more beneficial.

Secondly, there is a built in feature in CF for chart graphing that is much easier to use.

http://livedocs.adob...=Tags_c_05.html

Here is the documentation for cfchart.
Was This Post Helpful? 0
  • +
  • -

#4 Unohoo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 19-June 13

Re: return coldfusion array in flot

Posted 18 July 2013 - 07:51 AM

Thanks @Craig328 and @FusionNinja for the reply. I finally got the charts working. It was a json formatting issue. Thanks again.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1