dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18524
[Branch ~dhis2-documenters/dhis2/dhis2-docbook-docs] Rev 564: Docs for carousel plugin
------------------------------------------------------------
revno: 564
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2-docbook-docs
timestamp: Thu 2012-08-02 15:23:42 +0200
message:
Docs for carousel plugin
modified:
src/docbkx/en/dhis2_user_man_web_api.xml
--
lp:~dhis2-documenters/dhis2/dhis2-docbook-docs
https://code.launchpad.net/~dhis2-documenters/dhis2/dhis2-docbook-docs
Your team DHIS 2 developers is subscribed to branch lp:~dhis2-documenters/dhis2/dhis2-docbook-docs.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-documenters/dhis2/dhis2-docbook-docs/+edit-subscription
=== modified file 'src/docbkx/en/dhis2_user_man_web_api.xml'
--- src/docbkx/en/dhis2_user_man_web_api.xml 2012-08-01 11:29:29 +0000
+++ src/docbkx/en/dhis2_user_man_web_api.xml 2012-08-02 13:23:42 +0000
@@ -745,8 +745,40 @@
<para>To see a complete working example please visit <ulink url="http://apps.dhis2.org/portal/chart.html"/>.</para>
</section>
<section>
+ <title>Example: Creating a chart carousel with the carousel plugin</title>
+ <para>The chart plugin also makes it possible to create a chart carousel which for instance can be used to create an attractive front page on a Web portal. To use the carousel we need to import a few files in the head section of our HTML page:</para>
+ <screen>
+<link rel="stylesheet" type="text/css" href="http://apps.dhis2.org/demo/dhis-web-commons/javascripts/ext/resources/css/ext-plugin-gray.css" />
+<link rel="stylesheet" type="text/css" href="http://apps.dhis2.org/demo/dhis-web-commons/javascripts/ext-ux/carousel/css/carousel.css" />
+<script type="text/javascript" src="http://extjs-public.googlecode.com/svn/tags/extjs-4.0.7/release/ext-all.js"></script>
+<script type="text/javascript" src="http://apps.dhis2.org/demo/dhis-web-commons/javascripts/ext-ux/carousel/Carousel.js"></script>
+<script type="text/javascript" src="http://apps.dhis2.org/demo/dhis-web-commons/javascripts/plugin/plugin.js"></script></screen>
+ <para>The first file is the CSS stylesheet for the chart plugin. The second file is the CSS stylesheet for the carousel widget. The third file is the Ext javascript framework which this plugin depends on. The fourth file is the carousel plugin javascript file. The fifth file is the chart plugin javascript file. The paths in this example points at the DHIS 2 demo site, make sure you update them to point to your own DHIS 2 installation.</para>
+ <para>Please refer to the section about the chart plugin on how to do authentication.</para>
+ <para>To create a chart carousel we will first render the charts we want to include in the carousel using the method described in the chart plugin section. Then we create the chart carousel itself. The charts will be rendered into <emphasis role="italic">div</emphasis> elements which all have a CSS class called <emphasis role="italic">chart</emphasis>. In the carousel configuration we can then define a <emphasis role="italic">selector</emphasis> expression which refers to those div elements like this:</para>
+ <screen>DHIS.getChart({ uid: 'R0DVGvXDUNP', el: 'chartA1', url: base });
+DHIS.getChart({ uid: 'X0CPnV6uLjR', el: 'chartA2', url: base });
+DHIS.getChart({ uid: 'j1gNXBgwKVm', el: 'chartA3', url: base });
+DHIS.getChart({ uid: 'X7PqaXfevnL', el: 'chartA4', url: base });
+
+new Ext.ux.carousel.Carousel( 'chartCarousel', {
+ autoPlay: true,
+ itemSelector: 'div.chart',
+ interval: 5,
+ showPlayButton: true
+});</screen>
+ <para>The first argument in the configuration is the id of the div element in which you want to render the carousel. The <emphasis role="italic">autoPlay</emphasis> configuration option refers to whether we want the carousel to start when the user loads the Web page. The <emphasis role="italic">interval</emphasis> option defines how many seconds each chart should be displayed. The <emphasis role="italic">showPlayButton</emphasis> defines whether we want to render a button for the user to start and stop the carousel. Finally we need to insert the div elements in the body of the HTML document:</para>
+ <screen><div id="chartCarousel">
+
+<div id="chartA1" class="chart"></div>
+<div id="chartA2" class="chart"></div>
+<div id="chartA3" class="chart"></div>
+<div id="chartA4" class="chart"></div></screen>
+ <para>To see a complete working example please visit <ulink url="http://apps.dhis2.org/portal/carousel.html"/>.</para>
+ </section>
+ <section>
<title>Example: Embedding report tables with the table plugin</title>
- <para>In this example we will see how we can embed dynamic data tables in a Web page with data provided from a DHIS back-end server using the table plugin. The table plugin resides inside the same file as the chart plugin so please refer to the above section on how to include the required javascript and CSS files and how to do authentication. The available table options are listed in the table below.</para>
+ <para>In this example we will see how we can embed dynamic data tables in a Web page with data provided from a DHIS back-end server using the table plugin. The table plugin resides inside the same file as the chart plugin so please refer to the section about the chart plugin above on how to include the required javascript and CSS files and how to do authentication. The available table options are listed in the table below.</para>
<table>
<title>Table plugin configuration</title>
<tgroup cols="5">