• Could you pls. lookup my code.

    By jas aj 1 decade ago

    Hi,

     

    I am trying to use your java chart with xpages but I am facing difficulties.  I use this code to fill data on one of the pie chart field namely the chartItems, but not working.

    var v:NotesView = database.getView("BySector");
    var nav:NotesViewNavigator = v.createViewNavFromCategory(viewScope.searchValue);
    var entry:NotesViewEntry = nav.getFirst();
    var col1Arr = new Array();
    while (entry !=null){
            //viewScope.column1+=dash+entry.getColumnValues()[1].toString();
            col1Arr.push('"'+entry.getColumnValues()[1] +'"');    

        var tmpentry:NotesViewEntry = nav.getNextCategory();

        entry.recycle();

        entry = tmpentry;
        
    }
    //viewScope.col1Arr1 = col1Arr;
    return col1Arr;

    Could you pls. advice, Thank you in advance.

    • Need some more information...

      By Naveen Maurya 1 decade ago

       

      Hi Jas,
      
       
      
      The code looks fine to me. What exactly is the problem you are facing? Is the code giving an error or the chart is being displayed with incorrect values?
      
       
      
      If the code is giving you error then can you send it to me so that I can have a look at it? You can find the error in your log.nsf database.
      

      Regards,

      Naveen Maurya

       

      • Refresh problem

        By jas aj 1 decade ago

        Hi Naveen,

        Sorry for the delayed response.

        The graph don't show up when you embed it on a panel and the panel is set to PARTIAL REFRESH.  If you use the browser refresh then the graph will show up with the correct data.

        I tested it on the internet explorer 8 and firefox 8.0. My environment is LOTUS 8.5.2 FP2 and Domino 8.5.2

        Here is my code.

        xml version="1.0" encoding="UTF-8"?>

        <xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xc="http://www.ibm.com/xsp/custom">

         

        <xp:this.resources>

        <xp:script src="/yn_support.jss" clientSide="false">xp:script>

        xp:this.resources>

         

         

         

         

        <xp:panel id="body">

        <xp:comboBox id="comboBox1" value="#{sessionScope.searchValue}" style="font-size:10pt;color:rgb(0,0,255);font-weight:bold">

        <xp:selectItems>

        <xp:this.value>#{javascript:@Unique(@DbColumn("","ByIncome",0))}]]>xp:this.value>

        xp:selectItems>

        <xp:eventHandler event="onchange" submit="true" refreshMode="partial" refreshId="body">

        xp:eventHandler>xp:comboBox>

        <xc:BALChart includeGeneratedDateTime="true" type="Bar"

        orientation="Vertical" enableExport="true" height="500" width="500"

        title="Income volume" labelx="x" labely="y">

        <xc:this.chartValues>#{javascript:var v:NotesView = database.getView("ByIncome");

        var nav:NotesViewNavigator = v.createViewNavFromCategory(sessionScope.searchValue);

        var entry:NotesViewEntry = nav.getFirst();

        var col3Arr = new Array();

        var x=0;

        while (entry !=null){

         

        col3Arr[x]=entry.getColumnValues()[2];

        //col1Arr[x]=@ReplaceSubstring((entry.getColumnValues()[colNumb]),",",":");

        var tmpentry:NotesViewEntry = nav.getNextCategory();

         

        entry.recycle();

         

        entry = tmpentry;

        x=x+1;

        }

        return col3Arr }]]>xc:this.chartValues>

        <xc:this.chartSeries>#{javascript:var v:NotesView = database.getView("ByIncome");

        var nav:NotesViewNavigator = v.createViewNavFromCategory(sessionScope.searchValue);

        var entry:NotesViewEntry = nav.getFirst();

        var col2Arr = new Array();

        var x=0;

        while (entry !=null){

         

        col2Arr[x]=entry.getColumnValues()[2];

        //col1Arr[x]=@ReplaceSubstring((entry.getColumnValues()[colNumb]),",",":");

        var tmpentry:NotesViewEntry = nav.getNextCategory();

         

        entry.recycle();

         

        entry = tmpentry;

        x=x+1;

        }

        return col2Arr }]]>xc:this.chartSeries>

        <xc:this.chartCategories>#{javascript:var v:NotesView = database.getView("ByIncome");

        var nav:NotesViewNavigator = v.createViewNavFromCategory(sessionScope.searchValue);

        var entry:NotesViewEntry = nav.getFirst();

        var col1Arr = new Array();

        var x=0;

        while (entry !=null){

         

        col1Arr[x]=entry.getColumnValues()[1];

        //col1Arr[x]=@ReplaceSubstring((entry.getColumnValues()[colNumb]),",",":");

        var tmpentry:NotesViewEntry = nav.getNextCategory();

         

        entry.recycle();

         

        entry = tmpentry;

        x=x+1;

        }

        return col1Arr }]]>xc:this.chartCategories>

        xc:BALChart>xp:panel>

        xp:view>

         

        • Partial Refresh may not work.

          By Naveen Maurya 1 decade ago

          Hi,

          I don't think the problem lies with your code. If you open the "BALChart" custom control in designer, in the Events tab you will find code written in the beforePageLoad event. Here I actually store the data that you pass on to the custom control in sessionScope variable, which is then processed and the chart image is generated. But this event does not fire in partial refresh. You can try to add the code in afterRestoreView, as it gets executed in case of partial refresh. I actually never tested it for partial refresh

          I will surely work on this one and probably can add this to my next release. Smile

          Regards,

          Naveen Maurya

          • Surely,I will wait for your update

            By jas aj 1 decade ago

            Hi ,

            Thanks for the reply. I will look forward of your next release will the partial update feature.

            More power to you.