Skip to content

Commit 63c706a

Browse files
committed
Data-Forge Plot is now just a wrapper for the Plot library.
1 parent 7624429 commit 63c706a

15 files changed

+423
-2849
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"editor.tabSize": 4,
3-
"editor.renderWhitespace": "boundary",
3+
"editor.renderWhitespace": "none",
44
"editor.insertSpaces": true,
55
"typescript.reportStyleChecksAsWarnings": true,
66
"editor.trimAutoWhitespace": true,

README.md

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
The forgiving plotting API designed for use with [Data-Forge](https://github.com/data-forge/data-forge-ts).
44

5+
Data-Forge Plot is now a simple wrapper for [the Plot library](https://www.npmjs.com/package/plot).
6+
57
Use Data-Forge Plot to quickly and conveniently render charts from your data in JavaScript or TypeScript. It is an abstraction layer that connects Data-Forge with JavaScript visualization libraries so that it's easy to plot charts from your data.
68

79
Why not do your data wrangling, analysis and visualization entirely in JavaScript? To support my effort please buy or help promote my book
@@ -15,6 +17,24 @@ Please join the conversation on [Gitter](https://gitter.im/data-forge)
1517

1618
## Breaking changes
1719

20+
As of version 1.0.0 Data-Forge Plot has been gutted and reimplimented in terms of the [Plot library](https://www.npmjs.com/package/plot) (which is very similar). DFP is now just a wrapper for Plot to ease my maintence burden.
21+
22+
The function `exportWeb` has been removed because it is to difficult to maintain.
23+
24+
If you want to use this in the browser please use the [Plot library](https://www.npmjs.com/package/plot) instead, e.g.:
25+
26+
```javascript
27+
const dataframe = ...
28+
const plotConfig = { ... };
29+
const axisMap = { ... };
30+
import { plot } from "plot";
31+
import "@plotex/render-dom";
32+
plot(dataframe.toArray(), plotConfig, axisMap)
33+
.renderDOM(document.getElementByID("a-chart");
34+
```
35+
36+
--
37+
1838
As of version 0.4.0 the Nightmare/Electron depenency has been removed along with the `renderImage` function.
1939
2040
The `renderImage` function has been moved to the separate library [@data-forge-plot/render](todo). This has been removed due to the size that the Electron dependency adds to this package. In the future you you will have to install the separate package to render a plot to an image.
@@ -26,7 +46,6 @@ Please note that the sample code below to see how the new library is installed a
2646
2747
- To simply and conveniently from a series or dataframe to chart.
2848
- To create charts and visualizations in Node.js and the browser.
29-
- To export web-based interactive charts that can easily be hosted under a web-server.
3049
- To be able to serialize a chart to JSON and then reinstantiate it from the JSON in a web-app.
3150
- To separate configuration and data definition to make it easy to reuse charts.
3251
- To configure charts in JSON or fluent API.
@@ -37,15 +56,16 @@ Some instructions for using Data-Forge Plot. These instructions are for JavaScri
3756
3857
### Install
3958
40-
npm install --save data-forge data-forge-plot @data-forge-plot/render
59+
npm install --save data-forge data-forge-plot @plotex/render-image
4160
4261
### Setup
4362
4463
```javascript
4564
const dataForge = require('data-forge');
4665
require('data-forge-fs'); // Extends Data-Forge with 'readFile' function.
4766
require('data-forge-plot'); // Extends Data-Forge with the 'plot' function.
48-
require('@data-forge-plot/render'); // Extends Data-Forge Plot with the 'renderImage' function.
67+
require('@plotex/render-image'); // Extends Data-Forge Plot with the 'renderImage' function.
68+
require('@plotex/render-dom'); // Extends Data-Forge Plot with the 'renderDOM' function.
4969
```
5070
5171
### Rendering a chart from a CSV file to an image file
@@ -55,27 +75,11 @@ Some instructions for using Data-Forge Plot. These instructions are for JavaScri
5575
await dataFrame.plot().renderImage("my-chart.png");
5676
```
5777
58-
### Exporting a chart from a CSV file to an interactive web visualization
78+
### Rendering a chart to a web page.
5979
6080
```javascript
61-
const dataFrame = await dataForge.readFile("my-data-file.csv").parseCSV();
62-
await dataFrame.plot().exportWeb("./output-path");
81+
const dataArray = // ... acquire data, e.g. from a REST API ...
82+
const dataFrame = new DataFrame(dataArray);
83+
const chartElement = document.getElementById("chart");
84+
await dataFrame.plot().renderDOM(chartElement);
6385
```
64-
65-
### More docs coming soon
66-
67-
It's early days for DFP. I'll be working on more docs soon.
68-
69-
To see examples of API usage please see my blog posts:
70-
- http://www.the-data-wrangler.com/introducing-data-forge-plot/
71-
- http://www.the-data-wrangler.com/data-forge-plot-update/
72-
- http://www.the-data-wrangler.com/data-forge-plot-update2/
73-
- http://www.the-data-wrangler.com/data-forge-plot-update3/
74-
75-
There's also a first example of DFP here (JavaScript):
76-
77-
https://github.com/data-forge/data-forge-plot-first-example
78-
79-
And a bunch of examples in this repo:
80-
81-
https://github.com/data-forge/data-forge-plot-examples

0 commit comments

Comments
 (0)