Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. Highcharts.visualize = function (table, options) {
  2. // the categories
  3. options.xAxis.categories = [];
  4. $('thead th:parent', table).each(function (i) {
  5. var month = $(this).text();
  6. options.xAxis.categories.push(month);
  7. });
  8. console.log(options.xAxis.categories);
  9. // tthe data series
  10. options.series = [];
  11. $('tbody tr', table).each(function (i) {
  12. var tr = this;
  13. var serie = {};
  14. serie.name = $('th', tr).text();
  15. serie.data = [];
  16. $('td', tr).each(function (j) {
  17. var amount = this.innerHTML;
  18. amount = amount.split('.').join("");
  19. serie.data.push(parseFloat(amount));
  20. });
  21. options.series.push(serie);
  22. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement