Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. initializeDoughnut(map) {
  2. console.log(this.name.replace(/s/g, ''));
  3. var doughnutMarker = createHTMLMapMarker({
  4. latlng: new google.maps.LatLng((this.latlng.lat()+0.00006),(this.latlng.lng()-0.00007)),
  5. map: map,
  6. html: `<div id="canvas-holder`+this.name.replace(/s/g, '')+`" class="doughnut">
  7. <canvas id="chart-area`+this.name.replace(/s/g, '')+`" width="110" height="110" />
  8. </div>
  9. `
  10. })
  11. google.maps.event.addListenerOnce(map, 'idle', function(){
  12. console.log("Map is idle at " + this.name);
  13. this.loaddoughnut();
  14. }.bind(this));
  15. }
  16.  
  17. loaddoughnut() {
  18. var colors = ['#27AE60','#E74C3C'];
  19.  
  20. var donutOptions = {
  21. cutoutPercentage: 80,
  22. legend: {display: false}
  23. };
  24.  
  25. var donutData1 = {
  26. labels: [],
  27. datasets: [
  28. {
  29. backgroundColor: colors.slice(0,2),
  30. borderWidth: 0,
  31. data: [0, 0, 100],
  32. label: "Doughnut 1"
  33. },
  34. ]
  35. };
  36.  
  37. var config = {
  38. type: 'doughnut',
  39. data: donutData1,
  40. options: donutOptions
  41.  
  42. }
  43. console.log(document);
  44. console.log(document.getElementById("canvas-holder"+this.name.replace(/s/g, '')));
  45. console.log(document.getElementById("chart-area"+this.name.replace(/s/g, '')));
  46. // Line which gives the error
  47. var ctx = document.getElementById("chart-area"+this.name.replace(/s/g, '')).getContext("2d");
  48. this.doughnutChart = new Chart(ctx, config);
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement