svelte-frappe-charts

📈 Svelte bindings for frappe-charts.

GitHub Actions - Test Workflow Badge GitHub Actions - Test Workflow Badge Downloads
--- Makes it easy to use [frappe-charts](https://frappe.io/charts) in your [Svelte](https://svelte.dev/) project. ### Installation ``` yarn add svelte svelte-frappe-charts npm i -S svelte svelte-frappe-charts ``` > **Note**: Assumes you are using `>= svelte@4.0.0`. ### Usage Use the chart in your Svelte project with ease: ```svelte ``` The component API directly matches the [the configuration of `frappe-charts`](https://frappe.io/charts/docs/reference/configuration). ### Updating data There are two ways to update data in a chart: either in adding and removing individual points, or updating the existing data with an entirely new set of data points. #### Updating individual data points ##### addDataPoint Add a data point to the chart, increasing the length of the dataset. ```svelte ``` [More info on `addDataPoint`](https://frappe.io/charts/docs/reference/api#adddatapoint). ##### removeDataPoint Remove a data point from the chart, reducing the length of the dataset. ```svelte ``` [More info on `removeDataPoint`](https://frappe.io/charts/docs/reference/api#removedatapoint). #### Updating full data Update the entire data, including annotations, by passing the entire new data object to update. ```svelte ``` ### Chart navigation [Chart navigation](https://frappe.io/charts/docs/update_state/navigation) can be used when the `isNavigable` prop is set on the `Chart` component. Once it is set, the `data-select` event is propagated and can be handled in Svelte's standard ways (see the Events section of the tutorial and examples, and [the API docs](https://svelte.dev/docs#on_component_event)). ```svelte

Svelte Frappe charts navigation demo

``` ### Exporting charts You can easily export a chart ([see Exporting](https://frappe.io/charts/docs/exporting/images)) as an SVG by storing a reference to the `` component, and then calling `exportChart` on it: ```svelte ``` ### Contributing [Issues](https://github.com/himynameisdave/svelte-frappe-charts/issues/new) and pull requests are greatly welcome! --- _✌️Created by [Dave](http://himynameisdave.com). Licenced under MIT._