I have a table (from MS SQL) that contains account numbers, and then 24 fields with end of month balances for the past 2 years (b1, b2, b3, b4 …).
I’d like to use the sparklines library to display this.
I’ve successfully set it up (using the demo file) to display on the grid using the demo’s randomly generated values.
My challenge is how to use these fields (b1, b2, b3 …) to be the values for the sparkline.
The demo loads the values into an array named nums. The demo has a loop that loads random values into each of the elements of that array.
——————-
var nums = new Array;
for (var e=0; e<10; e++) {
nums[e] = (Math.round((max-min) * Math.random() + min))
}
$(this).sparkline(nums, {type: ‘line’, width: ‘100%’});
————–
My question then is how can I get the values of those fields from the table into that array? I’m not sure if this is a php question, or a javascript question, so any pointers would be helpful.
I would take a look at Documentation and then FAQs followed by Javascript API FAQs. There’s snippets of Javascript to access the data in the table.
E.g. var rows = $(‘#list1’).getRowData()
If you search for this code on this page, you will see other snippets of potential use nearby.
Hope this helps,
Gary