ogobrecht/d3-force-apex-plugin

APEX plug-in: Sample data is rendered before live data

ogobrecht opened this issue · 11 comments

When using the APEX plug-in sample data is rendered before live data is loaded via AJAX call. This is not always the case - for an example the sample app does not has this issue, one of my Universal Theme apps has it. Need some investigation to figure out what the problem is.

Do let me know if I can assist from my side. :)

Hi Ignacius,

there is a new beta version available - please download the v3 branch (direct download link) and install the plugin file /apex-plugin/d3-force-apex-plugin-3.0.beta1.sql.

Also see below the extract from the README changelog section - please note that the online docs not updated yet (means, the links pointing to the v2.2.0 online docs), because this branch is currently not merged until you tell me, that all your problems are gone and you find no new bugs. If you want to have a look at the new docs/API reference, then please see the docs folder of the downloaded v3 branch and start the file docs/index.html in your browser. If you have any questions please let me know.

THANK YOU FOR YOUR HELP, beta tester Ignacius ;-)

Best regards
Ottmar

3.0.0 (2018-10-xx)

Because of breaking API changes we have a new major realease:

  • Overall improvements
    • Better responsibility by implementing a ResizObserver (native in Chrome since v64, polyfill for other browsers)
      • Default true for the following options: zoomToFitOnForceEnd (was false in the past), zoomToFitOnResize (new option), keepAspectRatioOnResize (new option)
      • When setting the option useDomParentWidth to true together with the previous mentioned defaults you can achieve a responsibility like with images set to width 100% - see the [online demo][4] and play around with it
    • All zoom relevant methods are no longer depending on the zoomMode - they work simply always
    • The zoomMode sets only the ability for the end user to use zoom and pan
  • Fixed
    • APEX plug-in - sample data is rendered before live data (#32) - thanks are going to github.com/Ignacius68 for finding this bug
  • New events
  • New options
  • Changed methods
    • zoom has now a parameter duration (API reference)
    • translate has now a parameter duration (API reference)
    • useDomParentWidth (API reference) no longer needs a render call to take into effect - it works now immediately; Please remove unneccesary render calls to save CPU and battery time
  • Deprecated methods for clean API
    • zoomSmooth - can be replaced with the zoom method (API reference), please provide a appropriate duration parameter (default is 1500 with zoomSmooth)

Hi Ottmar!

Didn't mean to go radio silent. I've been working to get a stable version of my app moved up to a higher environment, so I can install this beta in dev. Bear with me. I'll be able to test within a couple weeks.

  • Ig

Hi Ignacius,

no problem, simply come back to me when you are done with testing. And thank you again for your help.

Best regards
Ottmar

Hi Ottmar,

I've begun testing, and getting some mixed results.

On the positive:

  1. Sample data is no longer loading before my queries. There is now only one render cycle, so my event scripts just got a lot easier!
  2. The addition of the delimiter split for labels is also a great help!
    a. I'm curious on this one, if the Width value is still in effect, or is it ignored when a delimiter is chosen? I'm wondering if I need to watch the lengths on the split parts.

On the negative:

  1. I'm seeing a LOT of "NaN" javascript errors (at least 1000 each page load), see embedded image:
    image
    a. These all seem to be the same function "u" in d3-3.5.6.min.js, line 177 (using Chrome "pretty print" formatting)
    b. I have no rectangle objects, so no idea why that's showing up
    c. I added a basic "transform" element to the Configuration Object, but that only lessened the number of errors for "translate":
    "transform": { "translate": [ 0, 0 ], "scale": 1 }

  2. I have one page that's defined as Tab Containers, where one of my tabs is a graph, and another is a View and Preferences management UI. When I switch tabs and then come back to the graph, I am losing Zoom and Pan ability. I have those settings as such:
    "zoomMode": true, "zoomToFitOnForceEnd": false, "zoomToFitOnResize": false, "keepAspectRatioOnResize": false,

  3. Perhaps related to 2), it seems the graph is re-centering after every render, even if I had panned to a different area of the graph. I have both zoom-to-fit options as false, so I didn't expect this. Renders also seem to be triggered by moving nodes (Pin mode is true), which could have already existed and I just didn't notice. The re-centering, however, presents an annoyance to the User.

Here is my full Configuration Object for reference. I may have some competing settings by accident?
{ "pinMode": true, "nodeEventToStopPinMode": "none", "onNodeContextmenuPreventDefault": true, "nodeEventToOpenLink": "none", "nodeLinkTarget": "none", "wrapLabels": true, "labelSplitCharacter": "::", "wrappedLabelWidth": 200, "wrappedLabelLineHeight": 1, "labelDistance": 6, "labelPlacementIterations": 10, "tooltipPosition": "svgTopLeft", "gridSize": 100, "linkDistance": 90, "useDomParentWidth": true, "width": 1000, "height": 700, "setDomParentPaddingToZero": true, "lassoMode": true, "zoomMode": true, "transform": { "translate": [ 0, 0 ], "scale": 1 }, "zoomToFitOnForceEnd": false, "zoomToFitOnResize": false, "keepAspectRatioOnResize": false, "chargeDistance": 200, "charge": -400, "gravity": 0.005, "linkStrength": 0.7, "debug": true }

Let me know if I can provide further information.

  • Ig

Hi Ignacius,

I will have a look at it on the weekend. Thanks for the testing so far.

  • I think some trouble come from a hidden tab container - good finding, was not in my focus that a container could be hidden some times...
  • The rectangle errors come from aligning of all the SVG containers for zoom and pan, seems also related to the hidden container, has nothing to do with your data, I will see,,,
  • If you define a split character, than the width value is ignored... at least this was the idea...

You will hear from me. Best regards
Ottmar

Wanted to also call out the re-centering after every render. With a large graph where you're zoomed into a particular part, you don't want the view moving unexpectedly. This re-centering just started with this version, I double checked 2.2.2 and there's no center at the end of a render.

Thanks for working on this! Absolutely loving the plugin. :)

Hi Ignacius,

sorry, my weekend was not going as expected. I need some days more to work on the issues. You are absolutely right: when an end user has the ability to zoom, the recentering should be ignored after force end, even it is switched on. The zoom mode should have precedence.

You will hear from me, best regards
Ottmar

Hi Igancius,

beta 2 is available. Please try it out. Hopefully all your errors are gone and you find no new ones :-)

Best regards
Ottmar

Hi Ottmar,

I got the new Beta 2 installed and tested, and I can't find any more bugs! All the original goodies check out as well.

  1. JS errors are all gone!
  2. Zoom and Pan continue to work no matter how often I switch Tabs and hide the graph.
  3. No more recentering with zoomtofit = false.

Thanks much! I'll look forward to the release so I can start promoting up beyond QA. :)

  • Ig

Hi Ignacius,

the release 3.0.0 is out. Thank you very much again for your help!

I had to fix a small bug regarding the legend - so please update to the current version.

Best regards
Ottmar