Advertisement
Guest User

Untitled

a guest
Dec 13th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. this.pieChartColors = [
  2. {
  3. backgroundColor: [
  4. this.configFn.rgba(this.config.colors.success, 0.7),
  5. this.configFn.rgba(this.config.colors.warning, 0.7),
  6. this.configFn.rgba(this.config.colors.danger, 0.7)
  7. ],
  8. hoverBackgroundColor: [
  9. this.config.colors.success,
  10. this.config.colors.warning,
  11. this.config.colors.danger
  12. ],
  13. borderColor: this.config.colors.grayLight,
  14. borderWidth: 1,
  15. hoverBorderWidth: 3
  16. }
  17. ];
  18. this.pieChartOptions = {
  19. title: {
  20. display: true,
  21. text: 'Corporate Info With %',
  22. fontColor: this.config.colors.gray,
  23. fontSize: 14,
  24. fontStyle: 'normal'
  25. },
  26. legend: {
  27. labels: {
  28. fontColor: this.configFn.rgba(this.config.colors.gray, 0.9),
  29. }
  30. },
  31. tooltips:{
  32. enabled:true,
  33. backgroundColor: this.configFn.rgba(this.config.colors.main, 0.7),
  34. callbacks:{
  35. label: function(tooltipItem, data) {
  36. var dataset = data.datasets[tooltipItem.datasetIndex];
  37. var total = dataset.data.reduce(function(previousValue, currentValue, currentIndex, array) {
  38. return previousValue + currentValue;
  39. });
  40. var currentValue = dataset.data[tooltipItem.index];
  41. var precentage = Math.floor(((currentValue/total) * 100)+0.5);
  42. return data.labels[tooltipItem.index] + ': ' + precentage + '%';
  43. }
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement