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.
 
 
 

83 lines
1.7 KiB

  1. import { sampleData } from './data';
  2. export const docSections = [
  3. {
  4. name: "start",
  5. contentBlocks: [
  6. {
  7. type: "text",
  8. content: `A chart is generally a 2D rendition of data. For example, f
  9. or a set of values across items, the data could look like:`
  10. },
  11. {
  12. type: "code",
  13. content: ` data = {
  14. labels: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
  15. datasets: [
  16. { values: [18, 40, 30, 35, 8, 52, 17, -4] }
  17. ]
  18. }`
  19. },
  20. {
  21. type: "text",
  22. content: `Plug that in with a type 'bar', a color and height:`
  23. },
  24. {
  25. type: "code",
  26. content: ` new frappe.Chart( "#chart", {
  27. data: data,
  28. type: 'bar',
  29. height: 140,
  30. colors: ['red']
  31. });`
  32. },
  33. {
  34. type: "demo",
  35. config: {
  36. data: sampleData[0],
  37. type: 'line',
  38. height: 140,
  39. colors: ['red'],
  40. },
  41. },
  42. {
  43. type: "text",
  44. content: `Similar is a 'line' chart:`
  45. },
  46. {
  47. type: "code",
  48. content: ` ...
  49. type: 'line',
  50. ...`
  51. },
  52. {
  53. type: "demo",
  54. config: {
  55. data: sampleData[0],
  56. type: 'bar',
  57. height: 140,
  58. colors: ['blue'],
  59. },
  60. }
  61. ]
  62. },
  63. {
  64. title: "Adding more datasets",
  65. name: "multi-dataset",
  66. contentBlocks: [
  67. {
  68. type: "text",
  69. content: `Having more datasets, as in an axis chart, every dataset is represented individually.`
  70. },
  71. {
  72. type: "demo",
  73. config: {
  74. data: sampleData[1],
  75. type: 'line',
  76. height: 200,
  77. colors: ['yellow', 'light-green'],
  78. },
  79. }
  80. ]
  81. }
  82. ]