Defect #630
Error creating chart
0%
Description
I've got the following chart string generated by the google online chart editor:
http://chart.googleapis.com/chart?chxl=0:|2012-02|2012-04|2012-06|2012-08|2012-10|2012-12&chxp=0,1,3,5,7,9,11&chxr=0,0,11|1,0,285&chxs=0,676767,11.5,0,lt,676767&chxt=x,y&chs=440x220&cht=lxy&chco=3072F3&chds=0,100,-3.333,277&chd=t:-1|163,10,10,10,10,5,16,10,10,11,19,277&chdl=Doorlooptijd&chdlp=b&chls=2&chma=5,5,5,25&chtt=Doorlooptijd
The Chart Script Builder returned the following code for the chartdef:
var eastwood = false; var chartDef = {}; chartDef.width = 840; chartDef.height = 350; chartDef.title = 'Doorlooptijd'; chartDef.legendPosition = 'bottom'; chartDef.margins = { left: 5, right: 5, top: 5, bottom: 25 }; chartDef.xAxis = { positions: [1,3,5,7,9,11], style: { textColor: '#676767', fontSize: 11.5, alignment: 'center', drawTickMarks: true, tickMarkColor: '#676767' }, maxRange: 11.0, labels: ['2012-02','2012-04','2012-06','2012-08','2012-10','2012-12'], minRange: 0.0 }; chartDef.yAxis = { maxRange: 285.0, minRange: 0.0 }; chartDef.yMin = -3.333; chartDef.yMax = 277.0; chartDef.lines = []; chartDef.lines.push( { xData: [0.0,9.1,18.2,27.3,36.4,45.5,54.5,63.6,72.7,81.8,90.9,100.0], yData: [163.0,10.0,10.0,10.0,10.0,5.0,16.0,10.0,10.0,11.0,19.0,277.0], legend: 'Doorlooptijd', color: '#3072F3' } ); return plugins.VelocityReport.getChart(plugins.VelocityReport.CHART.XYLINE, chartDef, eastwood, plugins.VelocityReport.REPORT.RESOLUTION_LOW);
However running this in the solution returned an error on the return :
Exception Object: org.mozilla.javascript.EvaluatorException: Cannot convert <img src="http://chart.apis.google.com/chart?chdlp=b&cht=lxy&chxt=y,x&chs=840x350&chma=5,5,5,25&chtt=Doorlooptijd&chxr=0,0.0,285.0|1,0.0,100.0&chxs=1,676767,11,0,lt,676767&chxl=1:|2012-02|2012-04|2012-06|2012-08|2012-10|2012-12&chxp=1,9.090909090909092,27.27272727272727,45.45454545454545,63.63636363636363,81.81818181818183,100.0&chd=t:0.0,9.1,18.2,27.3,36.4,45.5,54.5,63.6,72.7,81.8,90.9,100.0|163.0,10.0,10.0,10.0,10.0,5.0,16.0,10.0,10.0,11.0,19.0,277.0&chds=0.0,100.0,-3.3,277.0" border="0" class="chart" width="840" height="350"></img> to org.mozilla.javascript.Scriptable (D:\\servoy61_workspace\\pronto\\forms\\report_dtl.js#1652) MSG: Cannot convert <img src="http://chart.apis.google.com/chart?chdlp=b&cht=lxy&chxt=y,x&chs=840x350&chma=5,5,5,25&chtt=Doorlooptijd&chxr=0,0.0,285.0|1,0.0,100.0&chxs=1,676767,11,0,lt,676767&chxl=1:|2012-02|2012-04|2012-06|2012-08|2012-10|2012-12&chxp=1,9.090909090909092,27.27272727272727,45.45454545454545,63.63636363636363,81.81818181818183,100.0&chd=t:0.0,9.1,18.2,27.3,36.4,45.5,54.5,63.6,72.7,81.8,90.9,100.0|163.0,10.0,10.0,10.0,10.0,5.0,16.0,10.0,10.0,11.0,19.0,277.0&chds=0.0,100.0,-3.3,277.0" border="0" class="chart" width="840" height="350"></img> to org.mozilla.javascript.Scriptable (D:\\servoy61_workspace\\pronto\\forms\\report_dtl.js#1652) <null> Cannot convert <img src="http://chart.apis.google.com/chart?chdlp=b&cht=lxy&chxt=y,x&chs=840x350&chma=5,5,5,25&chtt=Doorlooptijd&chxr=0,0.0,285.0|1,0.0,100.0&chxs=1,676767,11,0,lt,676767&chxl=1:|2012-02|2012-04|2012-06|2012-08|2012-10|2012-12&chxp=1,9.090909090909092,27.27272727272727,45.45454545454545,63.63636363636363,81.81818181818183,100.0&chd=t:0.0,9.1,18.2,27.3,36.4,45.5,54.5,63.6,72.7,81.8,90.9,100.0|163.0,10.0,10.0,10.0,10.0,5.0,16.0,10.0,10.0,11.0,19.0,277.0&chds=0.0,100.0,-3.3,277.0" border="0" class="chart" width="840" height="350"></img> to org.mozilla.javascript.Scriptable (D:\\servoy61_workspace\\pronto\\forms\\report_dtl.js#1652) Cannot convert <img src="http://chart.apis.google.com/chart?chdlp=b&cht=lxy&chxt=y,x&chs=840x350&chma=5,5,5,25&chtt=Doorlooptijd&chxr=0,0.0,285.0|1,0.0,100.0&chxs=1,676767,11,0,lt,676767&chxl=1:|2012-02|2012-04|2012-06|2012-08|2012-10|2012-12&chxp=1,9.090909090909092,27.27272727272727,45.45454545454545,63.63636363636363,81.81818181818183,100.0&chd=t:0.0,9.1,18.2,27.3,36.4,45.5,54.5,63.6,72.7,81.8,90.9,100.0|163.0,10.0,10.0,10.0,10.0,5.0,16.0,10.0,10.0,11.0,19.0,277.0&chds=0.0,100.0,-3.3,277.0" border="0" class="chart" width="840" height="350"></img> to org.mozilla.javascript.Scriptable (D:\\servoy61_workspace\\pronto\\forms\\report_dtl.js#1652)
History
Updated by Patrick Talbot about 12 years ago
- Priority changed from High to Normal
What do you do with the script? How do you call it?
It seems that the calling function is expecting a Scriptable, but the plugin getChart is returning a Chart object (which is excpected), this Chart Object can also optionally be seen as a String and used in a HTML_AREA field for example, but it is not a Scriptable (not a JavaScript Object like {} or new Obkect() would be).
Updated by Jos de Bruijn about 12 years ago
you're right.
I was using the code from the example and there the getchartdef function return only the chartdef object, which is later passed to teh plugin to get the chart. And the generated code already returns the chart, I did not notice that sorry. This issue can be closed.