The ArcadiaCharts library can be remotely hosted on another server than your website. Perhaps you wish to use our free hosted library on hosted.arcadiacharts.com
or you use a content delivery network for some static content of your webpage.
There are many reasons to use a remotely hosted ArcadiaCharts library:
hosted.arcadiacharts.com/arcadiacharts.nocache.js
. (Please keep in mind that this doesn´t work on pages where you aren´t allowed to use JavaScript at all.)Due to the same-origin-policy of current browsers there are some drawbacks when using a hosted version of the library:
And of course it´s not possible to use charts - not even with a hosted library - where you aren´t allowed to insert JavaScript code at all.
Using our free library is easy. Simply replace
<script type="text/javascript" src="arcadiacharts/arcadiacharts.nocache.js"></script>
with:
<script type="text/javascript" src="http://hosted.arcadiacharts.com/arcadiacharts.nocache.js"></script>
Here is an example of a chart using the hosted version of ArcadiaCharts. Differences to an usual chart are highlighted:
<div id="myChart"></div> <script type="text/javascript" src="http://hosted.arcadiacharts.com/arcadiacharts.nocache.js"></script> <script type="text/javascript"> document.onChartLibLoaded = function() { var myData = "Month,Max Temperature, Min Temperature, Precipitation\n"+ "Jan, 26.7, 18.7, 90.2\n"+ "Feb, 26.9, 18.6, 56.1\n"+ "Mar, 27.6, 19.6, 55.9\n"+ "Apr, 28.2, 20.4, 39.1\n"+ "May, 29.3, 21.3, 28\n"+ "Jun, 30.3, 22.3, 12.7\n"+ "Jul, 30.8, 23.1, 15\n"+ "Aug, 31.5, 23.4, 11.2\n"+ "Sep, 31.4, 23.1, 19.8\n"+ "Oct, 30.5, 22.4, 57.9\n"+ "Nov, 28.9, 21.3, 76.2\n"+ "Dec, 27.3, 19.4, 96.5\n"; // Chart creation with ChartBuilder new ac.ACLineChartBuilder() .setTitle("Climate at Honolulu, Hawaii") .setData(myData) .setTheme('theme_standard_business.xml') .setColorScheme('color_scheme_green.xml') .setWidth(450) .setHeight(290) .build() .addToDom('myChart'); } </script>
As explained before, you can only access built-in themes and color schemes when using the remotely hosted library. Hence both the theme and the color scheme are specified by their name without any path. (To learn more about built-in vs. external themes see here)
To host your ArcadiaCharts library on a remote server, simply copy the /arcadiacharts/ folder to the desired location and call the arcadiacharts.nocache.js
with the according domain:
<script type="text/javascript" src="http://your.desired.location/arcadiacharts.nocache.js"></script>
Since it´s not possible to use external themes and color schemes with a remotely hosted library, you don´t need to copy the /arcadiacharts/themes/ folder.