Skip to content

Commit ba87ef2

Browse files
authored
Merge pull request #24 from zingchart/refactor-zingchart-dependency
feat: remove the zingchart dependency from being compiled within the …
2 parents 33548e8 + fddedf5 commit ba87ef2

18 files changed

Lines changed: 1591 additions & 388 deletions

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,7 @@ dist/zingchart-react.es.js.map
2929
!dist/zingchart-react.js
3030

3131
# Example files
32-
example/package-lock.json
32+
example/package-lock.json
33+
34+
# Outher output files
35+
CHANGELOG.md

.travis.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

README.md

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# zingchart-react
2-
31
![](https://img.shields.io/npm/v/zingchart-react)
42
![](https://github.com/zingchart/zingchart-react/workflows/Build/badge.svg?branch=master)
53
![](https://github.com/zingchart/zingchart-react/workflows/Test/badge.svg?branch=master)
@@ -9,24 +7,42 @@
97
![](https://img.shields.io/david/peer/zingchart/zingchart-react)
108
![](https://img.shields.io/david/dev/zingchart/zingchart-react)
119

10+
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
11+
12+
[![](https://d2ddoduugvun08.cloudfront.net/items/1L0T1l1e0v2t150Q3e1y/Screen%20Recording%202020-06-04%20at%2011.47%20PM.gif?X-CloudApp-Visitor-Id=3179966)](https://codesandbox.io/s/zingchart-react-wrapper-example-dxfc9)
13+
14+
## Quickstart Guide
15+
1216
Quickly add charts to your React application with our ZingChart component
1317

1418
This guide assumes some basic working knowledge of React and jsx.
1519

16-
[![](https://d2ddoduugvun08.cloudfront.net/items/0g1a3H413A3k3r3Z0d2Y/Screen%20Recording%202020-02-03%20at%2002.20%20PM.gif)](https://codesandbox.io/s/zingchart-react-wrapper-example-dxfc9)
1720

1821
## 1. Install
1922

20-
Install the zingchart-react package via npm
23+
Install the `zingchart-react` package via npm
24+
25+
`npm install zingchart-react`
26+
27+
## 2. Include the `zinchart` package in your project
28+
29+
The `zingchart` package is a **DIRECT** dependency of `zingchart-react` but you can also update this package outside of this component. Meaning the wrapper is no longer tied to a ZingChart library version, but just the component itself.
30+
31+
You can import the library like so:
2132

22-
`$ npm install zingchart-react`
33+
```javascript
34+
// import the es6 version
35+
import 'zingchart/es6';
36+
```
2337

24-
## 2. Include the component in your project
38+
## 3. Include the component in your project
2539

2640
You can either include the zingchart-react component to your project via UMD or modules (reccomended).
2741

42+
2843
### Modules (reccomended)
2944
```js
45+
import 'zingchart/es6';
3046
import ZingChart from 'zingchart-react';
3147
```
3248

@@ -35,6 +51,7 @@ wrapped as a closure an eval statement so there is **NO** default
3551
export objects. Just import them.
3652

3753
```js
54+
import 'zingchart/es6';
3855
import ZingChart from 'zingchart-react';
3956
// EXPLICITLY IMPORT MODULE
4057
import 'zingchart-react/dist/modules/zingchart-depth.min.js';
@@ -44,23 +61,24 @@ import 'zingchart-react/dist/modules/zingchart-depth.min.js';
4461

4562
In your main html file, include the package as a script include.
4663
```html
64+
<script src="/path/to/zingchart.min.js"></script>
4765
<script src="/path/to/zingchart-react.js"></script>
4866
```
4967

50-
### Others
68+
### `zingchart` Global Objects
5169

52-
If you need access to the `window.ZC` and `window.zingchart` objects we have
53-
exported those as well. Here is how to import them.
70+
If you need access to the `window.zingchart` objects for licensing or development flags.
5471

5572
```javascript
56-
// export ZingChart react class then the ZC and zingchart window ojects
57-
import {default as ZingChart, zingchart, ZC} from 'zingchart-react';
73+
import zingchart from 'zingchart/es6';
74+
import ZingChart from 'zingchart-react';
5875

59-
// then you can define global zingchart variables (typically for performance optimization)
60-
zingchart.DEV.SKIPPROGRESS = 1; // skips the intro loading screen (most likely invisible to human eye anyway)
61-
zingchart.DEV.RESOURCES = 0; // indicates to the lib that there are no external resources to load (images)
76+
// zingchart object for performance flags
6277
zingchart.DEV.KEEPSOURCE = 0; // prevents lib from storing the original data package
63-
zingchart.DEV.COPYDATA = 0; // prevents lib from creating a copy of the data package instead of working with the provided one (which can be altered)
78+
zingchart.DEV.COPYDATA = 0; // prevents lib from creating a copy of the data package
79+
80+
// ZC object for license key
81+
zingchart.LICENSE = ['abcdefghijklmnopqrstuvwxy'];
6482
```
6583

6684
## Usage
@@ -95,6 +113,9 @@ class App extends Component {
95113

96114
## Parameters
97115

116+
The properties, or parameters, you can pass to the `<zingchart>` tag itself.
117+
118+
98119
### data [object]
99120

100121
```jsx
@@ -219,10 +240,11 @@ class App extends Component {
219240

220241
For a list of all the methods that you can call and the parameters each method can take, refer to the complete documentation on https://www.zingchart.com/docs/methods
221242

222-
## Hello World and Examples
243+
## Working Example
244+
223245
This repository contains a "Create React App" example to give you an easy way to see the component in action.
224246

225247
To start the sample application:
226248
```
227-
$ cd example && npm run start
249+
cd example && npm run start
228250
```

dist/zingchart-react.js

Lines changed: 1 addition & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/zingchart-react.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)