Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Multi axis plot not plotting second series if using Datasource

    SmartClient Version: v9.0p_2013-07-31/Pro Deployment (built 2013-07-31)

    Chrome Version 28.0.1500.95 m, Firefox, IE9

    I have 2 JSP trying to display a multi-axis facetchart inside a portal window, one JSP gets the chart data hardcoded within the JSP, the other gets it from a datasource, which loads it from a JS file. The data for both cases are the same.

    The one with hardcoded data within the same JSP works as expected. Whereas, the other only show one set of data, the other set is missing.

    Can you please investigate, thanks.
    Attached Files

    #2
    The problem is that the values for the "data" facet are not specified and so are auto-derived from the data when the chart is created. But at that time the chart has no data, so the facet is empty.

    The solution is to either:

    1) create the chart only once you actually have the data

    OR

    2) provide the list of values for the "date" facet explicitly

    Comment


      #3
      I don't quite understand that, if the data needs to be there when the chart create, how come the 'percent' axis drawn fine, but not 'events' axis?

      In any case, can you elaborate your option #2?

      Eventually, the implementation will contact our backend server to provide the data, do you mean it has to make 2 RPC calls to the backend, if so how?

      Comment


        #4
        You explicitly provided values for the metric facet. For the "date" facet you are relying on the chart to look at the data and populate facet.values based on what is found in the data.

        As far as option #2, we don't know anything about how data loading works in your actual application, maybe you already have the list of dates available somewhere. But as far as this sample code, yes that approach would require two trips. Approach #1 does not.

        Comment


          #5
          I have modified the test code so that it fetches from the datasource first, and on the callback create the multi-axis chart. But it still not drawing the 2nd set of data. I have attached the modified code, you can use the same JS data file. Thanks for looking into this.
          Attached Files

          Comment


            #6
            Now the issue is that you've declared the DataSourceFields for "events" and "percent" as type "text" whereas they should be "int" and "percent" respectively.

            Comment


              #7
              Thanks, that fixed it. Just a general question, how would one debug issue like this? Since there is not JavaScript error or log messages.
              What we are trying to do is develop a framework, users will create a portlet using smartclient widget and datasource, married them together and display it. It is important for us to easily identify user's mistakes like this.

              Comment


                #8
                We just echo'd the returned data to the log: isc.logWarn(isc.echoAll(data)). Then it was obvious what the difference was between that and multiaxis.js, and we looked at the DataSource definition and spotted the type:"text" declarations.

                Comment

                Working...
                X