Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

trends_regions.md 3.3 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. ## Area Chart
  2. An area chart is derived from a line chart, by marking the area between the X axis and the line plot. It is usually used to compare the areas under the curve for two or more different plots.
  3. ```js
  4. lineOptions: {
  5. areaFill: 1 // default: 0
  6. },
  7. ```
  8. <chart-demo data="1"
  9. v-bind:config="{
  10. type: 'line',
  11. height: 240,
  12. colors: ['violet'],
  13. lineOptions: {
  14. areaFill: 1
  15. },
  16. }">
  17. </chart-demo>
  18. ## Plotting Trends
  19. Line charts are great to show trends. One of the reasons they are interesting is because the data involved usually involves a large number of data points. For so many points, we'd really like to keep the plot as less detailed as we can, while also using the already present color to advantage. Let's see how we can change some properties of a default line chart can reduce clutter.
  20. ## Continuity
  21. The X axis (often the time axis) is usually continuous. That means we can reduce the redundancy of rendering every X label by allowing for only a few periodic ones.
  22. We can skip X labels by setting the `xIsSeries` property in `axisOptions` to `true`.
  23. ```js
  24. axisOptions: {
  25. xIsSeries: true // default: false
  26. },
  27. ```
  28. This results only some of the X ticks having a label.
  29. <chart-demo data="trends-data"
  30. v-bind:config="{
  31. type: 'line',
  32. height: 180,
  33. colors: ['violet'],
  34. axisOptions: {
  35. xAxisMode: 'tick',
  36. xIsSeries: 1
  37. }
  38. }">
  39. </chart-demo>
  40. The line plot in the above plot could still be simplified. For example, to maintain uniformity, we could opt out of showing the dots at all, with `hideDots`.
  41. ```js
  42. lineOptions: {
  43. hideDots: 1 // default: 0
  44. },
  45. ```
  46. <chart-demo data="trends-data"
  47. v-bind:config="{
  48. type: 'line',
  49. height: 180,
  50. colors: ['violet'],
  51. axisOptions: {
  52. xAxisMode: 'tick',
  53. xIsSeries: 1
  54. },
  55. lineOptions: {
  56. hideDots: 1
  57. },
  58. }">
  59. </chart-demo>
  60. Or you could just choose to show only the dots instead.
  61. ```js
  62. lineOptions: {
  63. hideLine: 1 // default: 0
  64. },
  65. ```
  66. <chart-demo data="trends-data"
  67. v-bind:config="{
  68. type: 'line',
  69. height: 180,
  70. colors: ['violet'],
  71. axisOptions: {
  72. xAxisMode: 'tick',
  73. xIsSeries: 1
  74. },
  75. lineOptions: {
  76. hideLine: 1
  77. },
  78. }">
  79. </chart-demo>
  80. Needless to say, turning both of them on would be too amusing to be of any use :)
  81. A subtle way to show gradation of values is to render a change in color with the magnitude of the values. The property that does this is called `heatline`.
  82. ```js
  83. lineOptions: {
  84. heatline: 1 // default: 0
  85. },
  86. ```
  87. <chart-demo data="trends-data"
  88. v-bind:config="{
  89. type: 'line',
  90. height: 180,
  91. colors: ['violet'],
  92. axisOptions: {
  93. xAxisMode: 'tick',
  94. xIsSeries: 1
  95. },
  96. lineOptions: {
  97. hideDots: 1,
  98. heatline: 1
  99. },
  100. }">
  101. </chart-demo>
  102. ## Combinations
  103. Here's a demo using different combinations of the line options.
  104. <chart-demo data="trends-data"
  105. v-bind:config="{
  106. type: 'line',
  107. height: 200,
  108. colors: ['violet'],
  109. axisOptions: {
  110. xAxisMode: 'tick',
  111. xIsSeries: 1
  112. }
  113. }"x
  114. v-bind:options="[
  115. {
  116. name: 'lineOptions',
  117. path: ['lineOptions'],
  118. type: 'Map',
  119. mapKeys: ['hideLine', 'hideDots', 'heatline', 'areaFill'],
  120. states: {
  121. 'Line': [0, 1, 0, 0],
  122. 'Dots': [1, 0, 0, 0],
  123. 'HeatLine': [0, 1, 1, 0],
  124. 'Area': [0, 1, 0, 1]
  125. },
  126. activeState: 'Area'
  127. }
  128. ]">
  129. </chart-demo>
  130. Next up, we'll start to annotate the data in charts.