Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

README.md 3.2 KiB

7 år sedan
7 år sedan
7 år sedan
7 år sedan
5 år sedan
7 år sedan
7 år sedan
7 år sedan
7 år sedan
7 år sedan
7 år sedan
7 år sedan
7 år sedan
7 år sedan
7 år sedan
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <div align="center">
  2. <img src="https://github.com/frappe/design/blob/master/logos/logo-2019/frappe-charts-logo.png" height="128">
  3. <a href="https://frappe.github.io/charts">
  4. <h2>Frappe Charts</h2>
  5. </a>
  6. <p align="center">
  7. <p>GitHub-inspired modern, intuitive and responsive charts with zero dependencies</p>
  8. <a href="https://frappe.github.io/charts">
  9. <b>Explore Demos » </b>
  10. </a>
  11. <a href="https://codepen.io/pratu16x7/pen/wjKBoq">
  12. <b> Edit at CodePen »</b>
  13. </a>
  14. </p>
  15. </div>
  16. <p align="center">
  17. <a href="https://bundlephobia.com/result?p=frappe-charts">
  18. <img src="https://img.shields.io/bundlephobia/minzip/frappe-charts">
  19. </a>
  20. </p>
  21. <p align="center">
  22. <a href="https://frappe.github.io/charts">
  23. <img src=".github/example.gif">
  24. </a>
  25. </p>
  26. ### Contents
  27. * [Installation](#installation)
  28. * [Usage](#usage)
  29. * [Contribute](https://frappe.io/charts/docs/contributing)
  30. * [License](#license)
  31. #### Installation
  32. ##### Via NPM
  33. Install via [`npm`](https://www.npmjs.com/get-npm):
  34. ```sh
  35. $ npm install frappe-charts
  36. ```
  37. and include in your project:
  38. ```js
  39. import { Chart } from "frappe-charts"
  40. ```
  41. Or include following for es-modules(eg:vuejs):
  42. ```js
  43. import { Chart } from 'frappe-charts/dist/frappe-charts.esm.js'
  44. // import css
  45. import 'frappe-charts/dist/frappe-charts.min.css'
  46. ```
  47. ##### or include within your HTML
  48. ```html
  49. <script src="https://cdn.jsdelivr.net/npm/frappe-charts@1.1.0/dist/frappe-charts.min.umd.js"></script>
  50. <!-- or -->
  51. <script src="https://unpkg.com/frappe-charts@1.1.0/dist/frappe-charts.min.umd.js"></script>
  52. ```
  53. #### Usage
  54. ```js
  55. const data = {
  56. labels: ["12am-3am", "3am-6pm", "6am-9am", "9am-12am",
  57. "12pm-3pm", "3pm-6pm", "6pm-9pm", "9am-12am"
  58. ],
  59. datasets: [
  60. {
  61. name: "Some Data", type: "bar",
  62. values: [25, 40, 30, 35, 8, 52, 17, -4]
  63. },
  64. {
  65. name: "Another Set", type: "line",
  66. values: [25, 50, -10, 15, 18, 32, 27, 14]
  67. }
  68. ]
  69. }
  70. const chart = new frappe.Chart("#chart", { // or a DOM element,
  71. // new Chart() in case of ES6 module with above usage
  72. title: "My Awesome Chart",
  73. data: data,
  74. type: 'axis-mixed', // or 'bar', 'line', 'scatter', 'pie', 'percentage'
  75. height: 250,
  76. colors: ['#7cd6fd', '#743ee2']
  77. })
  78. ```
  79. Or for es-modules (replace `new frappe.Chart()` with `new Chart()`):
  80. ```diff
  81. - const chart = new frappe.Chart("#chart", {
  82. + const chart = new Chart("#chart", { // or a DOM element,
  83. // new Chart() in case of ES6 module with above usage
  84. title: "My Awesome Chart",
  85. data: data,
  86. type: 'axis-mixed', // or 'bar', 'line', 'scatter', 'pie', 'percentage'
  87. height: 250,
  88. colors: ['#7cd6fd', '#743ee2']
  89. })
  90. ```
  91. If you want to contribute:
  92. 1. Clone this repo.
  93. 2. `cd` into project directory
  94. 3. `npm install`
  95. 4. `npm run dev`
  96. #### License
  97. This repository has been released under the [MIT License](LICENSE)
  98. ------------------
  99. Project maintained by [Frappe](https://frappe.io).
  100. Used in [ERPNext](https://erpnext.com). Read the [blog post](https://medium.com/@pratu16x7/so-we-decided-to-create-our-own-charts-a95cb5032c97).