Remote hosting of the ArcadiaCharts library

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.

Why hosting ArcadiaCharts on a remote server?

There are many reasons to use a remotely hosted ArcadiaCharts library:

  1. You want to display a chart on a website where you cant upload the library. An example would be a Blogger.com blog: While you can insert JavaScript into your postings on Blogger.com, it´s not allowed to upload JS files. You can still use charts into your Blogger.com blog by including the 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.)
  2. You have a big company website with a lot of traffic and you keep your static content on another server or an Amazon S3 bucket.
  3. You use a content delivery network like Akamai or Amazon CloudFront.

Limitations of remotely hosted library

Due to the same-origin-policy of current browsers there are some drawbacks when using a hosted version of the library:

  1. You can only use your own themes and color schemes when they are hosted on the same server than the page with the chart. It´s not possible to host themes and color schemes on a remote server. However, built-in themes and color schemes work fine.
  2. It´s not possible to access remotely hosted data files, even when your files are at the same location than 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 hosted library

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)

Hosting your own ArcadiaCharts library

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.