Chart Xml with get('D_X_X')

Use this board to ask questions or have discussions with other Genie users.
Post Reply
Tracker
Profound User
Posts: 21
Joined: Fri Jun 26, 2015 7:49 am
First Name: Fadiga
Last Name: Mamoud
Company Name: Allianz Africa Services
Zip / Postal Code: 00225
Country: Ivory Coast
Contact:

Chart Xml with get('D_X_X')

Post by Tracker »

Hi,
I would like to make a dynamic chart bind with "chart xml" property and screen element value for example

Code: Select all

<chart caption='Graphe' numberprefix='$' plotgradientcolor='' bgcolor='FFFFFF' showalternatehgridcolor='0' showplotborder='0' divlinecolor='CCCCCC' showvalues='1' showcanvasborder='0' canvasbordercolor='CCCCCC' canvasborderthickness='1' yaxismaxvalue='30000' captionpadding='30' linethickness='3' sshowanchors='0' yaxisvaluespadding='15' showlegend='1' use3dlighting='0' showshadow='0' legendshadow='0' legendborderalpha='0' showborder='0' palettecolors='#EED17F,#97CBE7,#074868,#B0D67A,#2C560A,#DD9D82'>
<set label='Online Ads' value='125000' issliced='1' />
<set label='Print Ads' value='110000' />
<set label='Content Marketing' value='" + get("D_5_63") + "'" />
<set label='Tradeshows' value='" + get("D_3_63") + "'" />
</chart>
.
ButI have a 'No data to display' message.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Chart Xml with get('D_X_X')

Post by Scott Klement »

I'm assuming this is just a snippet from a larger piece of code, because it makes absolutely no sense by itself.

Can you give me more information about this? How are you coding it? How are you applying the property?
Tracker
Profound User
Posts: 21
Joined: Fri Jun 26, 2015 7:49 am
First Name: Fadiga
Last Name: Mamoud
Company Name: Allianz Africa Services
Zip / Postal Code: 00225
Country: Ivory Coast
Contact:

Re: Chart Xml with get('D_X_X')

Post by Tracker »

I would like to implement chart widget like picture widget.png ; and this is a sample of code of xml I use to bind the widget. the last picture shows data on the screen that I use to make the chart
Attachments
widget3.PNG
widget3.PNG (11.75 KiB) Viewed 2453 times
widget1.PNG
widget1.PNG (31.19 KiB) Viewed 2453 times
widget.PNG
widget.PNG (36.22 KiB) Viewed 2453 times
Tracker
Profound User
Posts: 21
Joined: Fri Jun 26, 2015 7:49 am
First Name: Fadiga
Last Name: Mamoud
Company Name: Allianz Africa Services
Zip / Postal Code: 00225
Country: Ivory Coast
Contact:

Re: Chart Xml with get('D_X_X')

Post by Tracker »

this is the picture I get
Attachments
widget4.PNG
widget4.PNG (3.84 KiB) Viewed 2447 times
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Chart Xml with get('D_X_X')

Post by Scott Klement »

You've coded part of your data as XML data (which is what the property is expecting) but then you've coded part of it as JavaScript. The property doesn't know that it's JavaScript -- it's expecting XML. So it will try to treat it as XML, which of course won't be valid.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Chart Xml with get('D_X_X')

Post by Scott Klement »

In order for a property to be run as JavaScript code, it needs to start with "script:" or "js:". But, your code isn't valid JavaScript... to make it valid JavaScript, you need to put the whole XML document inside quotes and remove the extra line feeds from the middle.

The result would look like this:

Code: Select all

script: "<chart caption='Graphe' numberprefix='$' plotgradientcolor='' bgcolor='FFFFFF' showalternatehgridcolor='0' showplotborder='0' divlinecolor='CCCCCC' showvalues='1' showcanvasborder='0' canvasbordercolor='CCCCCC' canvasborderthickness='1' yaxismaxvalue='30000' captionpadding='30' linethickness='3' sshowanchors='0' yaxisvaluespadding='15' showlegend='1' use3dlighting='0' showshadow='0' legendshadow='0' legendborderalpha='0' showborder='0' palettecolors='#EED17F,#97CBE7,#074868,#B0D67A,#2C560A,#DD9D82'><set label='Online Ads' value='125000' issliced='1' /><set label='Print Ads' value='110000' /><set label='Content Marketing' value='" + get("D_5_63") + "' /><set label='Tradeshows' value='" + get("D_3_63") + "' /></chart>"
Notice that:

1) It now starts with "script:" so JavaScript will be expected.
2) The remainder of the data is now a valid JavaScript string expression.
3) Quotes are provided at the start/end of each string to be concatenated.
4) line feeds are removed
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests