-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get the slider value? #4
Comments
+100000000000000000000 |
The slider value can be obtained by slider.value() |
I'm also editing the title. |
How do I get a slide event? Or, better yet, how do I get an event when the user releases the slider after dragging? |
You can add a callback function to be called when the slider moves. Sorry, not gotten to the docs yet. // Callback function (a function that will be called with the slider obj as argument, when the slider // Set slider callback function |
What I really need is a callback when the drag completes. The scenario would be when the user slides and releases the slider, I need to get the value and save to the server. Listening to |
Yes, the callback function is called by the slider when the drag completes, not while its moving, sorry if that wasn't clear. |
The callback function is called continuously during the drag, not when it's complete. The log below shows one drag without releasing the mouse. this.slider = d3.slider()
.min(min)
.max(max)
.showRange(true)
.value(this.props.metric.goal)
.tickFormat(tickFormatter)
.tickValues(tv)
.stepValues(_.range(min, max+1))
.callback(function(evt) {
logger.debug('callback: ' + self.slider.value());
}); Console:
|
ahh! I forgot the d3 'drag' event was called during dragging, and not at the end. thanks! |
There is a problem, when i set a value after slider is init and draw, the slider can't redraw... How to do this? |
@sujeetsr Did you add callback for the 'dragend' event? I am trying to get value of the slider at any time. |
how for to get value
The text was updated successfully, but these errors were encountered: