Hi all,

Good day. Have issue on the Laszlo graph.

Following code will draw a chart (Openlaszlo ver 4), while click on the
button, a new data node "entry" will in insert into the dataset. How can
I make the graph auto redraw once the data node is inserted??

I try following method (after reading the code) but no luck.
        chart1.renderPlotArea();
        chart1.dataload();
        chart1.render();

Cheers,
James

------------------------------------------------------------------------
---
<canvas height="900" width="600" debug="true">
                <include href="charts/styles/chartstyle.lzx"/>
                <include href="charts/addon/zoomarea.lzx"/>


                <dataset name="gridcpu1hourhistory">
                        <entries>
                                <entry timestamp="1" a="40"  b="4"
c="35" d="25" />
                                <entry timestamp="2" a="40"  b="6"
c="55" d="50" />
                                <entry timestamp="3" a="40"  b="6"
c="75" d="66" />
                                <entry timestamp="4" a="40"  b="6"
c="50" d="35" />
                                <entry timestamp="5" a="40"  b="6"
c="60" d="45" />
                                <entry timestamp="6" a="50"  b="10"
c="95" d="88" />
                                <entry timestamp="7" a="50"  b="10"
c="100" d="100" />
                                <entry timestamp="8" a="40"  b="6"
c="45" d="30" />
                                <entry timestamp="9" a="40"  b="6"
c="50" d="35" />
                                <entry timestamp="10" a="40"  b="6"
c="50" d="40" />
                        </entries>
                </dataset>


                                <!-- LEGEND ASSOCIATED WITH THE CHART
-->
                                <legend name="legendbox"
        
chart="${chart1}"
        
legendFont="serif"
        
legendFontsize="14"
        
legendborder="false"
                                                                x="600"
                                                                y="350"
        
direction="vertical">
                                        <handler name="onitemmouseclick"
args="item">
                                                        var topseries =
this.getChartInstance().getDataSeries();

        
topseries.getDataSeries(item.identifier).enabled = item.linevisible;
        
this.getChartInstance().renderPlotArea();
                                                        item.linevisible
= !item.linevisible;
                                        </handler>
                                </legend>

                <linechart id="chart1" y="60" width="300" height="150"
datapath="gridcpu1hourhistory:/entries">


                                <dataseries >
                                        <datacolumn name="x"
columndatapath="entry/@timestamp" datatype="number"/>
                                        <dataseries label="wins">
                                                        <datacolumn
name="y"   columndatapath="entry/@a"
        
datatype="number"/>
                                                        <datacolumn
name="datatip" columndatapath="record"/>
                                        </dataseries>
                                        <dataseries label="losses">
                                                        <datacolumn
name="y" columndatapath="entry/@b"
        
datatype="number"/>
                                                        <datacolumn
name="datatip" columndatapath="record"/>
                                        </dataseries>
                                        <dataseries label="losses">
                                                        <datacolumn
name="y" columndatapath="entry/@c"
        
datatype="number"/>
                                                        <datacolumn
name="datatip" columndatapath="record"/>
                                        </dataseries>
                                        <dataseries label="losses">
                                                        <datacolumn
name="y" columndatapath="entry/@d"
        
datatype="number"/>
                                                        <datacolumn
name="datatip" columndatapath="record" />
                                        </dataseries>
                                        <datacolumn name="datalabels"
columndatapath="record/@attendance"/>
                        </dataseries>

                        <horizontalaxis name="haxis" interval="2"
type="linear"
                                        columnName="x" />
                        <verticalaxis name="vaxis" title=""
interval="20" type="linear" columnName="y"
                                        titleLocation="low"
minorTickEnabled="false" />

                        <handler name="ondata">
                                Debug.write('abc');
                        </handler>

                </linechart>

                <button>Add data
                        <handler name="onclick">
                                var currdp = new LzDatapointer();
        
currdp.setXPath('gridcpu1hourhistory:/entries/entry[1]');

                                while(currdp.selectNext());

                                currdp.addNode("entry", "",
{timestamp:"11", a:"40",  b:"4", c:"35", d:"25"});

                                //chart1.renderPlotArea();
                                //chart1.dataload();
                                //chart1.render();
                        </handler>
                </button>
 </canvas>

------------------------------------------------------------------
-
-
-
DISCLAIMER: 

This e-mail (including any attachments) may contain confidential 
information. If you are not the intended recipient, you are hereby 
notified that any dealing, review, distribution, printing, copying 
or use of this e-mail is strictly prohibited. If you have received 
this email in error, please notify the sender or MIMOS Berhad 
immediately and delete the original message. Opinions, conclusions 
and other information in this e-mail that do not relate to the 
official business of MIMOS Berhad and/or its subsidiaries shall be 
understood as neither given nor endorsed by MIMOS Berhad and/or its 
subsidiaries and neither MIMOS Berhad nor its subsidiaries accepts 
responsibility for the same. All liability arising from or in 
connection with computer viruses and/or corrupted e-mails is 
excluded to the fullest extent permitted by law.


Reply via email to