Skip to content

Commit 90965e9

Browse files
authored
Add link to React demo; demote loading from script
Move instructions for loading from script to the bottom of the page
1 parent f77eaf3 commit 90965e9

File tree

1 file changed

+39
-35
lines changed

1 file changed

+39
-35
lines changed

README.md

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -60,41 +60,7 @@ import "amcharts3/amcharts/xy";
6060
import "amcharts3/amcharts/radar";
6161
```
6262

63-
See the [amCharts documentation](https://github.com/amcharts/amcharts3) for more information on the available amCharts modules.
64-
65-
### Loading Cedar
66-
67-
Instead of [installing](installing-cedar) and [importing](importing-cedar) Cedar, you can load Cedar and its [dependencies](#dependencies) by including script tags that point to the CDN (or your locally installed versions of these libraries). This will make the `cedar` global available to your application.
68-
69-
#### From a CDN
70-
71-
```html
72-
<!-- load the amCharts base library -->
73-
<script src="https://www.amcharts.com/lib/3/amcharts.js"></script>
74-
<!-- in this case, we only need bar charts, so we'll load the appropriate amCharts script -->
75-
<script src="https://www.amcharts.com/lib/3/serial.js"></script>
76-
<!-- load the arcgis-rest-js scripts -->
77-
<script src="https://unpkg.com/@esri/arcgis-rest-request"></script>
78-
<script src="https://unpkg.com/@esri/arcgis-rest-feature-layer"></script>
79-
<!-- optionally load an amcharts theme; cedar provides a calcite theme -->
80-
<script src="https://unpkg.com/@esri/cedar/dist/umd/themes/amCharts/calcite.js"></script>
81-
<!-- load cedar -->
82-
<script src="https://unpkg.com/@esri/cedar/dist/umd/cedar.js"></script>
83-
```
84-
85-
If you need to use other chart types, or want to use amCharts plugins, load the appropriate amCharts scripts before loading cedar:
86-
87-
```html
88-
<!-- for pie charts -->
89-
<script src="https://www.amcharts.com/lib/3/pie.js"></script>
90-
<!-- for scatter and bubble charts -->
91-
<script src="https://www.amcharts.com/lib/3/xy.js"></script>
92-
<!-- for radar charts -->
93-
<script src="https://www.amcharts.com/lib/3/radar.js"></script>
94-
<!-- optioinally load the amcharts plugin to export the chart as and image or table -->
95-
<script src="https://www.amcharts.com/lib/3/plugins/export/export.min.js"></script>
96-
<link rel="stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" />
97-
```
63+
See the [amCharts documentation](https://github.com/amcharts/amcharts3) for more information on importing amCharts modules.
9864

9965
### Using Cedar
10066

@@ -155,6 +121,8 @@ chart.show();
155121

156122
See the [API documentation](https://esri.github.io/cedar/api) for further details on how to work with cedar charts.
157123

124+
See the [Demos](#demos) section below for examples of Cedar working with other libraries like ArcGIS API for JavaScript or React.
125+
158126
### Configuring Cedar
159127
You can configure cedar to use a custom implementation of `fetch()` by setting `cedar.config.fetch = myCustomFetch`.
160128

@@ -196,6 +164,42 @@ You can also see how to use cedar with the [ArcGIS API for JavaScript](https://d
196164
- [A chart using layer features as inline data](https://codepen.io/tomwayson/pen/mxdVqO)
197165
- [Using cedar w/ client-side LayerView queries](https://jsbin.com/juqafec/edit?html,output)
198166

167+
See [this CodeSandbox](https://codesandbox.io/s/esri-cedar-in-react-forked-kyoc2?file=/src/App.js) for an example of how to use Cedar in React.
168+
169+
### Loading Cedar
170+
171+
Instead of [installing](installing-cedar) and [importing](importing-cedar) Cedar, you can load Cedar and its [dependencies](#dependencies) by including script tags that point to the CDN (or your locally installed versions of these libraries). This will make the `cedar` global available to your application.
172+
173+
#### From a CDN
174+
175+
```html
176+
<!-- load the amCharts base library -->
177+
<script src="https://www.amcharts.com/lib/3/amcharts.js"></script>
178+
<!-- in this case, we only need bar charts, so we'll load the appropriate amCharts script -->
179+
<script src="https://www.amcharts.com/lib/3/serial.js"></script>
180+
<!-- load the arcgis-rest-js scripts -->
181+
<script src="https://unpkg.com/@esri/arcgis-rest-request"></script>
182+
<script src="https://unpkg.com/@esri/arcgis-rest-feature-layer"></script>
183+
<!-- optionally load an amcharts theme; cedar provides a calcite theme -->
184+
<script src="https://unpkg.com/@esri/cedar/dist/umd/themes/amCharts/calcite.js"></script>
185+
<!-- load cedar -->
186+
<script src="https://unpkg.com/@esri/cedar/dist/umd/cedar.js"></script>
187+
```
188+
189+
If you need to use other chart types, or want to use amCharts plugins, load the appropriate amCharts scripts before loading cedar:
190+
191+
```html
192+
<!-- for pie charts -->
193+
<script src="https://www.amcharts.com/lib/3/pie.js"></script>
194+
<!-- for scatter and bubble charts -->
195+
<script src="https://www.amcharts.com/lib/3/xy.js"></script>
196+
<!-- for radar charts -->
197+
<script src="https://www.amcharts.com/lib/3/radar.js"></script>
198+
<!-- optioinally load the amcharts plugin to export the chart as and image or table -->
199+
<script src="https://www.amcharts.com/lib/3/plugins/export/export.min.js"></script>
200+
<link rel="stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" />
201+
```
202+
199203
## Dependencies
200204

201205
Cedar isn't yet another JavaScript charting library. Instead, cedar is a very thin wrapper around other libraries that do the heavy lifting. Cedar uses [amCharts](https://www.amcharts.com/javascript-charts/) library as it's charting engine. Cedar also uses [@esri/arcgis-rest-feature-layer](https://esri.github.io/arcgis-rest-js/api/feature-layer/) and [@esri/arcgis-rest-request](https://esri.github.io/arcgis-rest-js/api/request/) to query feature data. You will need to [install](#installing-cedar) these libraries along with cedar in your application. If you are loading cedar from a CDN, please refer to the [loading cedar](#loading-cedar) section above for the `<script>` tags that you will need to include.

0 commit comments

Comments
 (0)