Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8842687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:01:23+00:00 2026-06-14T11:01:23+00:00

I have two graphs rendering with Rickshaw, perfectly fine. I have a single slider

  • 0

I have two graphs rendering with Rickshaw, perfectly fine. I have a single slider that I want to be able to manipulate both graphs, but what it’s doing now is manipulating the last graph that I declare:

//graph one
var graph_one = new Rickshaw.Graph( {
        element: document.querySelector("#chart_one"),
        height: 150,
        width: 170,
        renderer: 'bar',
        series: data
} );

//slider code
var slider_one = new Rickshaw.Graph.RangeSlider({
    element: document.querySelector('#slider-range'),
    graph: graph_one
});

graph_one.render();

//graph two
var graph_two = new Rickshaw.Graph( {
        element: document.querySelector("#chart_two"),
        renderer: 'line',
        height: 150,
        width: 170,
        series: data
} );

//slider code
var slider_two = new Rickshaw.Graph.RangeSlider({
    element: document.querySelector('#slider-range'),
    graph: graph_two
});

graph_two.render();

Is it possible to have one slider manipulate two graphs?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:01:24+00:00Added an answer on June 14, 2026 at 11:01 am

    I accomplished this by editing the rickshaw.js, specifically editing Rickshaw.Graph.RangeSlider to accept arrays of graphs as a graph variable:

    Rickshaw.Graph.RangeSlider = function(args) {
    
        var element = this.element = args.element;
        var graph = this.graph = args.graph;
        //added by bozdoz
        if(graph.constructor === Array){
                $( function() {
                    $(element).slider( {
                        range: true,
                        min: graph[0].dataDomain()[0],
                        max: graph[0].dataDomain()[1],
                        values: [ 
                            graph[0].dataDomain()[0],
                            graph[0].dataDomain()[1]
                        ],
                        slide: function( event, ui ) {
                            //on slide, move both graphs
                            for(var i=0; i < graph.length; i++){
                                graph[i].window.xMin = ui.values[0];
                                graph[i].window.xMax = ui.values[1];
                                graph[i].update();
    
                                // if we're at an extreme, stick there
                                if (graph[i].dataDomain()[0] == ui.values[0]) {
                                    graph[i].window.xMin = undefined;
                                }
                                if (graph[i].dataDomain()[1] == ui.values[1]) {
                                    graph[i].window.xMax = undefined;
                                }
                            }
                        }
                    } );
                } );
                graph[0].onUpdate( function() {
    
                    var values = $(element).slider('option', 'values');
    
                    $(element).slider('option', 'min', graph[0].dataDomain()[0]);
                    $(element).slider('option', 'max', graph[0].dataDomain()[1]);
    
                    if (graph[0].window.xMin == undefined) {
                        values[0] = graph[0].dataDomain()[0];
                    }
                    if (graph[0].window.xMax == undefined) {
                        values[1] = graph[0].dataDomain()[1];
                    }
    
                    $(element).slider('option', 'values', values);
    
                } );
                ...
    

    Then, when declaring the graphs, I only need to add the slider code to the last graph, including both graph variables as an array:

    var slider_two = new Rickshaw.Graph.RangeSlider({
        element: document.querySelector('#slider-range'),
        graph: [graph_one, graph_two]
    });
    

    Works exactly how I wanted it to work: http://jsfiddle.net/bozdoz/k4NmL/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have added two bar graphs with a barOffset so that both bar graphs
I'm using ggplot and have two graphs that I want to display on top
I have a number of algorithms for community detection on graphs that I want
I am using ZedGraph's master pane to display two graphs that have synchronized X
Suppose I have two columns in a table that represents a graph, the first
I have the data in two files. I want to plot a graph the
With this approach. I have a line plot graph. I want to plot 'two'
I have two graphs with in one image, each with 5 points. Their value
I am new to graphs. I have two sets in a bipartite graph. I
I have two graphs with different scale and I would like to use subplot.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.