Using Sparklines to show a balance trend over time

QuestionsUsing Sparklines to show a balance trend over time
John Muehleisen asked 2 years ago

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.

1 Answers
Gary Wilson answered 2 years ago

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

Your Answer

10 + 5 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?