HTML-JavaScript Usage

Introduction

With this usage model users can embed charts to any HTML content. The embedding page can be pure HTML page or any dynamic page (PHP, ASP, ...) producing HTML. This model uses Java Script to produce the wanted result. The loaded script produces wanted markup when the script is executed in the client browser (Java Script must be enabled and browser should support dynamic HTML).

Usage

User must add following code to a location where the chart should appear.

<script src="http://server1/addChart?source=http://server2/chartxml/chart1.xml"></script>

"server1" is a chart server URL and "server2" is a URL for a server serving Char XML document. The "source" attribute is mandatory and it is used to indicate the Chart XML location. There can be also other attributes. These attributes use same names as in "out" tag. Following example adds a "chartType" attribute with value "pie".

<script src="http://server1/addChart?source=http://server2/chartxml/chart1.xml&chartType=pie"></script>

Setup

There must be a Davisor Chart running in a known server and the used Chart XML must be available (typically from a same or other server). Chart server should have following entries at web.xml:

  <servlet>
    <servlet-name>addChart</servlet-name>
    <servlet-class>com.davisor.webapp.chart.ChartMarkupServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>addChart</servlet-name>
    <url-pattern>/addChart</url-pattern>
  </servlet-mapping>

Example

Chart image shown in a example HTML page (page contains also a table chart).