In polotly.js, how may I get call a javascript callback called when a slider is changed, and get its current value as argument? - plotly.js

I want to build a web page in plotly.js for plotting a mathematical function depending on some parameters. I want the user to be able to change it using a slider.
For doing this, I need to call my own javascript function (to recalculate the points of the graph), get the current value of the slider and update the graph.
I've looking at the examples in
https://plotly.com/javascript/sliders/
but none of them does what I need, and the documentation
at
https://plotly.com/javascript/reference/layout/sliders/
is not clear at all. It seems that I need to set the "method" property (also "args"). It says
"Sets the Plotly method to be called when the slider value is changed. If the skip method is used, the API slider will function as normal but will perform no API calls and will not bind automatically to state updates. This may be used to create a component interface and attach to slider events manually via JavaScript."
What does it mean?
I already have an application using plotly dash at
https://github.com/pdenapo/normal_bivariada/blob/main/normal_bivariada_interactiva.py
and it is very easy to do using #app.callback. However,
I want to do the same in javascript (since I want to run it on a web server, where I cannot run a python application).
¡Many thanks for any help!

Related

Tealium: Fire JavaScript pixel on button click

I'm a new Tealium user and I have the following problem:
I have a JavaScript pixel that has to be implemented on a certain button click. I created a custom container tag and I added the Javascript code by editing the tag's template like this:
Apart of that I have this code that runs when I click the button:
So, I added this load rule to the tag:
The problem is that I don't see that the tag fires when I click the button.
Can you help me to find what is wrong?
It looks like the link event data object is being set via a Tealium extension (but there is insufficient information in the question to be sure). If so, the scope and timing of that extension are critical for load rules processing. Make sure the variable event_name is getting set in an extension with a scope that allows execution before load rules. For a link event, this is typically “All Tags” scope and execution order is “Before Load Rules”.
Take a look at the Tealium extension docs for more information on Scope and Execution Order: https://community.tealiumiq.com/t5/iQ-Tag-Management/Extensions/ta-p/13649#toc-hId-1361707577
Alternatively, make sure that your custom tag is coded properly and validate that it works correctly. It’s possible that you need to update the u.ev variable (defines which event types the tag can run on) and/or need to provide more instructions in the u.loader_cb callback statement: https://community.tealiumiq.com/t5/iQ-Tag-Management/Tealium-Custom-Container-Tag/ta-p/14015
Debugging: https://community.tealiumiq.com/t5/iQ-Tag-Management/Debugging/ta-p/30675

Extjs how to get list of all events of component dynamically

I want to get the list of all events for any particular component dynamically. For example : If I take a Textfield , how can I get all possible events that are mentioned in ExtJs API Doc. so that user can choose and assign the event for any component.
component.events
Contains the list you need. You could have found out by yourself reading the source of addEvents method, which is linked from any event you wanted to find in a list.
For those still wanting an answer to this, https://coderwall.com/p/jnqupq/easily-capture-all-events-on-a-component-in-extjs has provided a nice means of doing so.
When debugging an ExtJS application, you'll often find it useful to listen to all events fired by a specific component. There is actually a handy built-in static method to do this called Ext.util.Observable.capture().
Here's a handy snippet that simply logs the event name and all arguments:
Ext.util.Observable.capture(myObj, function(evname) {console.log(evname, arguments);})
Even better, if you're currently inspecting your component's main element in your browser's developer tools, you can do this:
Ext.util.Observable.capture(Ext.getCmp($0.id), function(evname) {console.log(evname, arguments);})
Where $0 is the currently selected element. Should work fine in Chrome, Firefox, Opera, Safari.
If you don't want those logs to pollute your console anymore, simply call releaseCapture on your object:
Ext.util.Observable.releaseCapture(myObj);
This removes all captures on a given object so you don't have to reference your listener explicitly (which was likely an anonymous function :)).
Bonus tip: also be sure to check out the observe method which does something similar but allows you to listen to all events fired by all instances of a given class.

Is there a way to implement "onShow" using Prototype JS?

I searched the Prototype docs but found nothing. Did I miss something, or is there no such thing as onshow? I want to call a function when an element (a div in my case) is made visible. Is there such functionality in the Prototype framework? If not, I need a push in the right direction so I can solve it another way.
Thanks!
If you are asking if there is an event that is fired when the .show() method is called on elements there is not.
But you can test if an element is visible by using the $('myelementid').visible() method.
Also a different way I have done it in the past is using the Script.aculo.us .appear() method which has a afterFinish callback - for example
$('myelementid').appear({'afterFinish':function(effect){
//the afterFinish callback passes the effect as the first parameter
//call other function with element
otherfunction(effect.element);
});
technically you would only need to load the effects.js file of Script.aculo.us instead of all of the library to get the core effects methods.

Can I delay loading of some controls on an xPage to after page loaded

is it possible to delay loading of some controls on an xpage?
This is the problem: let's say you have a control that does a fultextsearch and displays the result in a repeat control. this ft search might take a long time and will hold the webpage loading in a waiting state until the search result is ready.
I want my page to load most of the data initally, and some "time consuming" controls should be loaded in to the page as a sperate request after the inital load.
this way the user will immediatly see the webpage, but some of the data on the page will load a little bit later without holding the webpage in a waiting state from the server.
possible?
The downside to using rendered is that all the value bindings will still evaluate, even if the corresponding markup isn't sent to the page. So the trick here is making sure the components don't even exist until you want them to.
Every component has a getChildren() method. This returns a mutable List of components, which has a add() method. This allows you to add components to the page on the fly, either while the page is loading, or later during an event. For the purposes of what you're trying to do, you would want to defer adding the "expensive" components until a subsequent event.
Create an event handler attached directly to the view root (), give it a unique ID (e.g. "loadExpensiveComponentsEvent", set its refresh mode to partial, set a refresh ID to whatever div or panel will contain the search results, and set its event name to an arbitrary event (e.g. "loadExpensiveComponents"). This prevents your event from being triggered by actual user behavior. Set the event's code to SSJS that will inject your components.
Then add a script block () to trigger the event after the page has loaded:
XSP.addOnLoad(function(){
XSP.firePartial(null, "#{id:loadExpensiveComponentsEvent}");
});
Your page will load without the search result components. Once the page has fully loaded, it will trigger the component injection event automatically.
For guidance on how to code the injection event, open the Java file that has been generated from your existing page to see what components need to be injected and what to set their values to.
You can pack them into a panel and set their rendered status to rendered=#{viewScope.pageFullyLoaded}. Then in the onLoad event have a XSP. partialRefresh request where you set viewScope.pageFullyLoaded=true
A little ugly but doable. Now you can wrap that code into your own custom control, so you could have a "lazyGrid", "lazyPanel" etc.
Not sure why I did not think of this before. the dynamic content control in extlib actually solves this problem. the dcc can be triggered onClientLoad both using javascript and ssjs afer the page has loaded.
one problem I am facing now is that I am already using the dcc on my site so I need to put another dcc within my dcc. and this seem to be a bit buggy. I have reported it to the extlib team on openNTF.

Allowing user selected Global Theme for winform app

I am using DevExpress controls in a winform app I am building for internal use. My app has about 30 forms in total and I am trying to figure out a way to allow my user's to select a theme. I have seen this mentioned here at SO multiple times in answers to other posts.
I understand how the StyleController works, I believe, but what I am wondering is how I can use 1 Style controller for the whole app.
Right now I am trying to create 1 StlyeController at the Shell form and then pass a reference to it to each child form. From there I then have to programatically set the StyleController property for each control. I don't mind I just wonder, especially from those who have done this, if there is a simpler way?
It is very simple. This example is assuming that you are using skins.
In the constructor of your main form calls:
DevExpress.Skins.SkinManager.EnableFormSkins();
This will enable your form to use the current skin. It is also important that each of your forms derived from XtraForm.
After that you need to setup the global look and feel object for your application:
//This set the style to use skin technology
DevExpress.LookAndFeel.UserLookAndFeel.Default.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Skin;
//Here we specify the skin to use by its name
DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle("Black");
If you want to set the look and feel of your application like Office 2003, the setup is different. You just have to call the following function:
DevExpress.LookAndFeel.UserLookAndFeel.Default.SetOffice2003Style();
So, every control of devexpress will use these settings to paint themselves. It is possible to specify a custom LookAndFeel object for some controls but I never used it because I dont see the point to have a custom display for a control or a form.
Exception:
There is one exception in Devexpress framework. The NavBarControl does not use the skin technology automatically from your global LookAndFeel object, you need to specify a setting to enable that:
//To use the current skin
youNavBarControl.PaintStyleName = "SkinNavigationPane";
//To use the current look and feel without the skin
youNavBarControl.PaintStyleName = "NavigationPane";
With version 11.2 I used the information in this article:
http://www.devexpress.com/Support/Center/p/K18013.aspx
In summary :
* Inherit all your forms from XtraForm
* Leave look and feel settings default so that they use the default skin
* Modify the default skin with the following line of code:
DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName = "DevExpress Dark Style";

Resources