← Back to team overview

dhis2-devs team mailing list archive

Re: Embedding a chart on an HTML page

 

Thanks Jan

I would like to have the years display seperately. I've tried this

rows : [{dimension:'co'},{dimension : 'pe',items : [ {id : 'LAST_5_YEARS'} ]

but the co labels are the only things that display.
The chart is able to display in the visualiser but I would like to let it
display for different org units.
Attached is a sample


Kind Regards
Pooben

On Mon, Nov 7, 2016 at 12:39 PM, Jan Henrik Øverland <jan@xxxxxxxxx> wrote:

> Hi Pooben,
>
> First of all, the chart plugin has been improved in 2.25 and will render
> charts with Highcharts instead of ExtJs. Which means you don't have to
> include ExtJs at all anymore. You need jQuery 2 though.
>
> You can link in the plugin from here: http://dhis2-cdn.org/
> v225/plugin/chart.js
>
> To load charts you can do:
>
> chartPlugin.url = '<url to instance>';
> chartPlugin.username = '<username>';
> chartPlugin.password = '<password>';
>
> chartPlugin.load([<array of chart configs>]);
>
>
> To answer your question, if you want to use "assigned categories" you can
> simply move periods to filter and do
>
> rows :  [ {dimension : 'co'} ]
>
>
> Remember that you can always create the chart you want in the app first
> and click "Embed" on the toolbar to see how the chart is configured.
>
> Jan
>
> On 4 November 2016 at 14:11, Pooben Dass <pooben@xxxxxxxx> wrote:
>
>>
>> ---------- Forwarded message ----------
>> From: Pooben Dass <pooben@xxxxxxxx>
>> Date: Fri, Nov 4, 2016 at 9:52 AM
>> Subject: Embedding a chart on an HTML page
>> To: dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>
>>
>> Hi Devs
>>
>> I'm trying to embed a chart with category options on to an HTML page.
>>
>> What is the correct format to map the co & de dimension? This is the
>> example for the de only?
>>
>> DHIS.getChart({
>> url : base,
>> el : 'chart1',
>> type : 'pie',
>> columns : [ {dimension : 'de',items : [ {id : 'DE_UID' }] } ],
>> rows :  [ {dimension : 'pe',items : [ {id : 'PE_UID' } ]} ],
>> filters : [{dimension : 'ou',items : [{id : 'UID' }] } ],
>> showData : true,
>> });
>>
>> DHIS2 version 2.25
>>
>>
>> Kind Regards
>> Pooben
>>
>>
>> *This message and any attachments are subject to a disclaimer published
>> at http://www.hisp.org/policies.html#comms_disclaimer
>> <http://www.hisp.org/policies.html#comms_disclaimer>.  Please read the
>> disclaimer before opening any attachment or taking any other action in
>> terms of this electronic transmission.  If you cannot access the
>> disclaimer, kindly send an email to disclaimer@xxxxxxxx
>> <disclaimer@xxxxxxxx> and a copy will be provided to you. By replying to
>> this e-mail or opening any attachment you agree to be bound by the
>> provisions of the disclaimer.*
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>
>
> --
> Jan Henrik Øverland
> Software developer, DHIS 2
> University of Oslo
> http://www.dhis2.org <https://www.dhis2.org/>
>

-- 


*This message and any attachments are subject to a disclaimer published at 
http://www.hisp.org/policies.html#comms_disclaimer 
<http://www.hisp.org/policies.html#comms_disclaimer>.  Please read the 
disclaimer before opening any attachment or taking any other action in 
terms of this electronic transmission.  If you cannot access the 
disclaimer, kindly send an email to disclaimer@xxxxxxxx 
<disclaimer@xxxxxxxx> and a copy will be provided to you. By replying to 
this e-mail or opening any attachment you agree to be bound by the 
provisions of the disclaimer.*

Attachment: Capture.PNG
Description: PNG image


References