You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

heatmap.md 1.7 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. ## Day-based Month-wise data
  2. The heatmap is a representation of day-wise data (similar to [the GitHub Contribution Graph]()). It spaces out data values linearly, across 5 levels (zero data kept exclusive).
  3. In this case, the data has three parts,
  4. ```js
  5. let data = {
  6. dataPoints: {
  7. "1426744959": 20,
  8. "1463673055": 113,
  9. "1476892421": 57,
  10. // ...
  11. },
  12. start: startDate, // a JS date object
  13. end: endDate
  14. }
  15. ```
  16. (We are working on making the start date and end date implicit and optional).
  17. The chart is rendered by the type `heatmap`:
  18. ```js
  19. let chart = new Chart("#heatmap", {
  20. type: 'heatmap',
  21. data: data,
  22. })
  23. ```
  24. <project-demo data="heatmap-data" v-bind:config="{
  25. title: 'Monthly Distribution',
  26. type: 'heatmap',
  27. }">
  28. </project-demo>
  29. Setting `discreteDomains` to `0` allows for a continous distribution of heat squares (as on GitHub), rather than showing the month-wise separation. A different set of colors can also be specified.
  30. ```js
  31. discreteDomains: 0, // default 1
  32. colors: ['#ebedf0', '#c0ddf9', '#73b3f3', '#3886e1', '#17459e'],
  33. ```
  34. <project-demo data="heatmap-data" v-bind:config="{
  35. title: 'Monthly Distribution',
  36. type: 'heatmap',
  37. height: 200,
  38. discreteDomains: 1,
  39. countLabel: 'Level',
  40. colors: ['#ebedf0', '#c0ddf9', '#73b3f3', '#3886e1', '#17459e'],
  41. }"
  42. v-bind:options="[
  43. {
  44. name: 'Discrete domains',
  45. path: ['discreteDomains'],
  46. type: 'Boolean',
  47. // boolNames: ['Continuous', 'Discrete'],
  48. states: { 'Discrete': 1, 'Continuous': 0 }
  49. },
  50. {
  51. name: 'Colors',
  52. path: ['colors'],
  53. type: 'Array',
  54. states: {
  55. 'Green (Default)': [],
  56. 'Blue': ['#ebedf0', '#c0ddf9', '#73b3f3', '#3886e1', '#17459e'],
  57. 'Halloween': ['#ebedf0', '#fdf436', '#ffc700', '#ff9100', '#06001c']
  58. }
  59. }
  60. ]">
  61. </project-demo>