DMXzone App Connect Support Product Page

Answered

App connect charts

Asked 19 Mar 2018 09:36:44
1
has this question
19 Mar 2018 09:36:44 Matthew Da Cruz posted:
I have the following results in a table cell.
0.67,0.82,0.82,1.00,0.82,0.82,0.67,0.67,0.82,0.82,0.82,0.82

Its 12 month trend data for a row. I want to put a sparkline chart on each row.
How do I assign the string 0.67,0.82,0.82,1.00,0.82,0.82,0.67,0.67,0.82,0.82,0.82,0.82 to a variable so i can use it in java script?

the container for chart
---------------------------------------------------------
<th> <span class="sparkline_bar" style="height: 160px;"> <canvas width="200" height="60" style="display: inline-block; vertical-align: top; width: 94px; height: 30px;"></canvas> </span> </th>

<!-- jQuery Sparklines -->
src="../jquery-sparkline/dist/jquery.sparkline.min.js"


I need to add the variable into this code to make sparkline work on each row.
How do replace the 2, 4, 3, 4, 5, 4, 5, 4, 3, 4, 5, 6, 4, 5, 6, 3, 5 with the data from my trends column data 0.67,0.82,0.82,1.00,0.82,0.82,0.67,0.67,0.82,0.82,0.82,0.82 per row?
------------------------------------------------------------------------

.sparkline([2, 4, 3, 4, 5, 4, 5, 4, 3, 4, 5, 6, 4, 5, 6, 3, 5],
had to remove javascript to post

Replies

Replied 19 Mar 2018 09:55:46
19 Mar 2018 09:55:46 Teodor Kuduschiev replied:
Hi Matthew,
It is not really clear from your post - is this data dynamic (from a database) ?
Replied 19 Mar 2018 10:31:47
19 Mar 2018 10:31:47 Matthew Da Cruz replied:
Yes, I am using app connect to build page.
In the database I have a column called trend. Each row has a different trend value "0.67,0.82,0.82,1.00,0.82,0.82,0.67,0.67,0.82,0.82,0.82,0.82" in the correct format for sparkline charts.

in order for spline charts to work we need to set the following variable that is a javascript snippet
.sparkline([0.67,0.82,0.82,1.00,0.82,0.82,0.67,0.67,0.82,0.82,0.82,0.82],

 <!-- jQuery Sparklines -->
      src="../vendors/jquery-sparkline/dist/jquery.sparkline.min.js"

 <!-- jQuery Sparklines -->
      
      
        $(".sparkline_bar").sparkline([2, 4, 3, 4, 5, 4, 5, 4, 3, 4, 5, 6, 4, 5, 6, 3, 5], {





Im not sure how to get the value set dynamically in the page
Replied 19 Mar 2018 10:44:05
19 Mar 2018 10:44:05 Teodor Kuduschiev replied:
It is not possible to use dynamic app connect data in javascript code.
Replied 19 Mar 2018 11:26:30
19 Mar 2018 11:26:30 Matthew Da Cruz replied:
can we set a php variable for each row instead? Php can get nested into javascript
Replied 19 Mar 2018 12:02:08
19 Mar 2018 12:02:08 Teodor Kuduschiev replied:
No, you cannot use app connect data in php variables.
We have a special app connect charts extension, which works with dynamic data from app connect: www.dmxzone.com/go/33054/app-connect-charts/
Replied 19 Mar 2018 13:48:35
19 Mar 2018 13:48:35 Matthew Da Cruz replied:
Thanks

Reply to this topic