Advertisement
Guest User

Untitled

a guest
Sep 18th, 2014
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. $.ajax({
  2.  
  3. cache: false,
  4. dataType: "json",
  5. url: "{% static 'money/data/highchartpiesam.json' %}" ,
  6. success: function(json) {
  7. console.log("haha i have read the json")
  8. console.log('Success',this.url)
  9. $('#containerHighChartJSONPie').highcharts({
  10. chart: {
  11. plotBackgroundColor: null,
  12. plotBorderWidth: 1,//null,
  13. plotShadow: false
  14. },
  15. title: {
  16. text: 'Expenses per Types of Expenditures'
  17. },
  18. tooltip: {
  19. pointFormat: '{point.name}: <b>{point.percentage:.1f}%</b>'
  20. },
  21. plotOptions: {
  22. pie: {
  23. allowPointSelect: true,
  24. cursor: 'pointer',
  25. dataLabels: {
  26. enabled: true,
  27. format: '<b>{point.name}</b>: {point.percentage:.1f} %',
  28. style: {
  29. color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
  30. }
  31. }
  32. }
  33. },
  34. series: [{
  35. type: 'pie',
  36. name: 'Type of Expenditure',
  37. data: json
  38. }]
  39. });
  40. }
  41. });
  42.  
  43. $(document).ready(function() {
  44. console.log("aah document is loaded ")
  45. console.log("File Name code");
  46. var a='{% static '.concat(''money/data/highchartpie').concat('{{ user.username }}').concat('.json'').concat("%}");
  47. console.log("File Name code : Value of initial string is a is ",a);
  48. var chartFileName=a;
  49. $.ajax({
  50.  
  51. cache: false,
  52. dataType: "json",
  53. url: chartFileName ,
  54. success: function(json) {
  55. console.log("haha i have read the json")
  56. console.log('Success',this.url)
  57. $('#containerHighChartJSONPie').highcharts({
  58. chart: {
  59. plotBackgroundColor: null,
  60. plotBorderWidth: 1,//null,
  61. plotShadow: false
  62. },
  63. title: {
  64. text: 'Expenses per Types of Expenditures'
  65. },
  66. tooltip: {
  67. pointFormat: '{point.name}: <b>{point.percentage:.1f}%</b>'
  68. },
  69. plotOptions: {
  70. pie: {
  71. allowPointSelect: true,
  72. cursor: 'pointer',
  73. dataLabels: {
  74. enabled: true,
  75. format: '<b>{point.name}</b>: {point.percentage:.1f} %',
  76. style: {
  77. color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
  78. }
  79. }
  80. }
  81. },
  82. series: [{
  83. type: 'pie',
  84. name: 'Type of Expenditure',
  85. data: json
  86. }]
  87. });
  88. }
  89. });
  90. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement