5 Replies Latest reply on Jun 12, 2008 12:26 PM by BSchow

    RemoteObject and lag

    BSchow
      Okay, here's the situation: I have a LineChart and a DataGrid, which take data from an SQL database. They do this by way of a .cfc file called as a RemoteObject. Clicking on the chart changes the data provider for the chart and the datagrid to a new table in the database (actually a subset of this new table). All is well.

      In trying to get the whole set-up working with a bigger SQL database, however, I've run into a problem. When I click on the chart, nothing happens. It worked before, it's the exact same code, so I go through and make sure it's accessing the database properly. It is.

      Some further fiddling and it turns out that if I click on the chart once, nada...clicking on it a second time causes the data to go through. This is fine for the DataGrid, but if I change the data provider for the chart as well, the chart goes blank and I can't click on it again to 'fix' this.

      Example:
      a) (not changing chart)
      1) click on chart. DataGrid goes blank.
      2) click on chart again. DataGrid fills with the appropriate values.
      b) (changing chart)
      1) click on chart. DataGrid and LineChart go blank.
      2) ????

      How do I fix this? Should I add a progress bar, maybe? I've tried waiting the change out but nothing seems to change even then.
        • 1. Re: RemoteObject and lag
          matthew horn Level 3
          Is it possible to take the database out of the equation and post a simple example that illustrates what is happening?

          matt horn
          flex docs
          • 2. Re: RemoteObject and lag
            Garyl Woolworth Level 1
            What version of Coldfusion are you running? We used to have this happen to us on CF 7 which I think at that point it was classified as a bug. However after upgrading the issue seemed to resolve itself when CF 8 added native connectors for a lot of the options that used to require 3rd party connectors.
            • 3. Re: RemoteObject and lag
              BSchow Level 1
              I'm using CF8.

              As for an example...hm, well, it's a fair bit of code, so I'll try and simplify.

              The application has a LineChart, which we'll call TestChart. It has an itemClick event which calls a function called zoomTest, a dataProvider which we'll call Foo, and also has...let's say two LineSeries called m1 and m2. Each LineSeries graphs some category from Foo (we'll say it's 'sales' and 'expenses' versus 'day'). It also has a horizontalAxis with categoryField=day, a VerticalAxis, and a horizontalAxisRenderers tag set equal to the horizontalAxis.

              Beneath TestChart is a DataGrid which we'll call TestDG. It has the same dataProvider (Foo), and two columns which we'll call mcol1 and mcol2. The two columns display the same data graphed in m1 and m2.

              The function zoomTest is, naturally, included in a Script tag above these two. When called it changes the dataProvider for TestChart and TestDG to a different ArrayCollection called Bar. It changes the categoryField for mcol1 and mcol2 to 'sales' and 'expenses' (but these have different values than in Foo).

              Additionally, zoomTest changes m1 and m2 to graph 'sales' and 'expenses' versus 'hour'. It changes the categoryField of the horizontalAxisRenderers to 'hour' as well.
              • 4. RemoteObject and lag
                BSchow Level 1
                Okay, well, I think I figured out the problem. Sorta. I threw in a little if-else statement into the zoomTest() function. If the dataProvider I'm switching to is null, it displays a message saying so (later on I'll .probably whip up a ProgressBar for this). Otherwise, it switches the dataProvider.

                Once again, everything is fine for the DataGrid. However, when it comes time to That Darn Linechart again, it's still not switching over properly. I've since isolated it to the chart's horizontalAxis, which has a CategoryAxis (and a categoryField, of course). If I don't change the categoryField in the zoomTest() function, the graph becomes blank. If I do, however, I get an error message. What exactly is this trying to tell me?

                EDIT: Interestingly enough, if I change the categoryField to something that doesn't exist in the new dataProvider, it simply displays a blank chart (sans error message). Very curious.
                • 5. Re: RemoteObject and lag
                  BSchow Level 1
                  Hehe...okay, it turns out that the problem lay between chair and keyboard.

                  It turns out you can't use integers as the categoryField for an axis, which I had been doing.