|
MultiChart issue |
Posted by Rick on Dec-19-2012 13:52 |
|
Hi Peter,
I can successfully output and update a polar chart using your getChart function/approach.
Today, I needed to take that polar chart, add a second xy chart and output that through
multichart. It also works fine in ultimately generating the image, however, it throws a
javascript syntax error regarding an unexpected '}'. So, I backed up and found that just
displaying the polar chart through multichart caused the problem -- it was unrelated to the
addition of the second graph.
After some more sleuthing, it appears the following javascript line is injected by $viewer-
>renderHTML() that is causing the problem (note the incomplete assignment for "c").
window.myChartName_chartModel={"charts":[{"x":0,"y":0,"c":}]};
This line does not appear to be generated when I use creating just a single graph, but it
shows up when using multichart.
Any idea how I might be able to fix this? Thanks in advance. |
Re: MultiChart issue |
Posted by Peter Kwan on Dec-20-2012 00:28 |
|
Hi Rick,
Are you using the Javascript Chart Model (have you got a line that uses setChartModel / getJsChartModel)?
Currently, the Javascript Chart Model only supports XYChart objects. If used for a MultiChart, it only works if all the charts in the MultiChart are XYChart objects.
If you are using the Javascript Chart Model, please remove the line to see if this can solve the problem.
Since you are writing a web page, if you need two charts, and one of the charts must have track cursor support (the Javascript chart model is designed to be used for track cursor support), you may consider to put them as two separate charts on the web page (use two WebChartViewer objects), instead of combining them into one big chart. In this way, the XYChart can use the Javascript Chart Model.
Hope this can help.
Regards
Peter Kwan |
Re: MultiChart issue |
Posted by Rick on Dec-20-2012 01:35 |
|
Thanks Peter, you hit the nail right on the head. It was the call to getJsChartModel that
was causing it!
I'd prefer not to split the two graphs into two images loaded separately, as this is one of 6
graphs that are being generated on this page. And they are actually showing the same
data, just two different ways.
Is it possible for me to "flatten" the polar chart into an in-memory image (with
makeChart2?) and then load that as an image into the drawArea of the XYChart?
Thanks! |
Re: MultiChart issue |
Posted by Peter Kwan on Dec-20-2012 23:47 |
|
Hi Rick,
Yes. The method is:
(a) Create the PolarChart object as usual.
(b) Create the XYChart object, with the chart size set up so as to reserve some empty space for the PolarChart.
(c) Use:
$myXYChart->makeChart3()->merge($myPolarChart->makeChart3(), $xCoor, $yCoor, TopLeft, 0);
(d) Then output XYChart as usual.
Hope this can help.
Regards
Peter Kwan |
|