您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

7 年前
7 年前
7 年前
7 年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. <a href="https://t.me/frappecharts">
  15. <b> Join on Telegram</b>
  16. </a>
  17. </p>
  18. </div>
  19. <p align="center">
  20. <a href="https://travis-ci.org/frappe/charts">
  21. <img src="https://img.shields.io/travis/frappe/charts.svg?style=flat-square">
  22. </a>
  23. <a href="http://github.com/frappe/charts/tree/master/dist/js/frappe-charts.min.iife.js">
  24. <img src="http://img.badgesize.io/frappe/charts/master/dist/frappe-charts.min.iife.js.svg?compression=gzip">
  25. </a>
  26. <a href="https://travis-ci.org/frappe/charts">
  27. <img src="https://img.shields.io/travis/frappe/charts.svg?style=flat-square">
  28. </a>
  29. </p>
  30. <p align="center">
  31. <a href="https://frappe.github.io/charts">
  32. <img src=".github/example.gif">
  33. </a>
  34. </p>
  35. ### Contents
  36. * [Installation](#installation)
  37. * [Usage](#usage)
  38. * [Contribute](https://frappe.io/charts/docs/contributing)
  39. * [Updates](#updates)
  40. * [License](#license)
  41. #### Installation
  42. * Install via [`npm`](https://www.npmjs.com/get-npm):
  43. ```console
  44. $ npm install frappe-charts
  45. ```
  46. and include in your project:
  47. ```js
  48. import { Chart } from "frappe-charts"
  49. ```
  50. ...or include following for es-modules(eg:vuejs):
  51. ```js
  52. import { Chart } from 'frappe-charts/dist/frappe-charts.esm.js'
  53. // import css
  54. import 'frappe-charts/dist/frappe-charts.min.css'
  55. ```
  56. * ...or include within your HTML
  57. ```html
  58. <script src="https://cdn.jsdelivr.net/npm/frappe-charts@1.1.0/dist/frappe-charts.min.iife.js"></script>
  59. <!-- or -->
  60. <script src="https://unpkg.com/frappe-charts@1.1.0/dist/frappe-charts.min.iife.js"></script>
  61. ```
  62. #### Usage
  63. ```js
  64. const data = {
  65. labels: ["12am-3am", "3am-6pm", "6am-9am", "9am-12am",
  66. "12pm-3pm", "3pm-6pm", "6pm-9pm", "9am-12am"
  67. ],
  68. datasets: [
  69. {
  70. name: "Some Data", type: "bar",
  71. values: [25, 40, 30, 35, 8, 52, 17, -4]
  72. },
  73. {
  74. name: "Another Set", type: "line",
  75. values: [25, 50, -10, 15, 18, 32, 27, 14]
  76. }
  77. ]
  78. }
  79. const chart = new frappe.Chart("#chart", { // or a DOM element,
  80. // new Chart() in case of ES6 module with above usage
  81. title: "My Awesome Chart",
  82. data: data,
  83. type: 'axis-mixed', // or 'bar', 'line', 'scatter', 'pie', 'percentage'
  84. height: 250,
  85. colors: ['#7cd6fd', '#743ee2']
  86. })
  87. ```
  88. ...or for es-modules:
  89. ```js
  90. //replace new frappe.Chart() with new Chart()
  91. const chart = new Chart("#chart", { // or a DOM element,
  92. // new Chart() in case of ES6 module with above usage
  93. title: "My Awesome Chart",
  94. data: data,
  95. type: 'axis-mixed', // or 'bar', 'line', 'scatter', 'pie', 'percentage'
  96. height: 250,
  97. colors: ['#7cd6fd', '#743ee2']
  98. })
  99. ```
  100. If you want to contribute:
  101. 1. Clone this repo.
  102. 2. `cd` into project directory
  103. 3. `npm install`
  104. 4. `npm run dev`
  105. #### Updates
  106. ##### v1.0.0
  107. - Major rewrite out. Some new features include:
  108. - Mixed type axis datasets
  109. - Stacked bar charts
  110. - Value over data points
  111. - Y Markers and regions
  112. - Dot size, Bar space size, and other options
  113. - Legend for axis charts
  114. - We would be looking to incorporate existing PRs and issues in the meantime.
  115. ##### Please read [#93](https://github.com/frappe/charts/issues/93) for v0.1.0 updates on rework and development.
  116. ##### v0.0.7
  117. - [Custom color values](https://github.com/frappe/charts/pull/71) for charts as hex codes. The API now takes an array of colors for all charts instead of a color for each dataset.
  118. - [@iamkdev's](https://github.com/iamkdev) blog on [usage with Angular](https://medium.com/@iamkdev/frappé-charts-with-angular-c9c5dd075d9f).
  119. ##### v0.0.5
  120. - More [flexible Y values](https://github.com/frappe/charts/commit/3de049c451194dcd8e61ff91ceeb998ce131c709): independent from exponent, minimum Y axis point for line graphs.
  121. - Customisable [Heatmap colors](https://github.com/frappe/charts/pull/53); check out the Halloween demo on the [website](https://frappe.github.io/charts) :D
  122. - Tooltip values can be [formatted](https://github.com/frappe/charts/commit/e3d9ed0eae14b65044dca0542cdd4d12af3f2b44).
  123. ##### v0.0.4
  124. - Build update: [Shipped](https://github.com/frappe/charts/pull/35) an ES6 module, along with the browser friendly IIFE.
  125. ##### v0.0.2
  126. - We have an animated [Pie Chart](https://github.com/frappe/charts/issues/29)! Thanks [@sheweichun](https://github.com/sheweichun).
  127. - [@tobiaslins](https://github.com/tobiaslins) contributed tweaks for his quest to make these easy to use with React. Check out his [repo](https://github.com/tobiaslins/frappe-charts-react-example) and updates at [#24](https://github.com/frappe/charts/issues/24) to learn more :)
  128. - A new logo.
  129. ##### v0.0.1
  130. - The very first version out, with animatable bars and lines, a percentage chart and a heatmap. GitHub-style.
  131. #### License
  132. This repository has been released under the [MIT License](LICENSE)
  133. ------------------
  134. Project maintained by [Frappe](https://frappe.io).
  135. Used in [ERPNext](https://erpnext.com). Read the [blog post](https://medium.com/@pratu16x7/so-we-decided-to-create-our-own-charts-a95cb5032c97).