• Demos
    • JavaScript Charts
    • JavaScript StockCharts
  • Download
    • Download Chart
    • Download StockChart
  • Integrations
    • Front End Technology Samples
      • React Charts
      • Angular Charts
      • Vue.js Charts New!
      • jQuery Charts
      • Dashboards
    • Server Side Technology Samples
      • PHP Charts
      • Python Charts New!
      • ASP.NET MVC Charts
      • Spring MVC Charts
      • JSP Charts
  • License
  • Blog
  • Docs
    • Chart Documentation
    • StockChart Documentation
  • Support Forum
    • Chart Support
    • StockChart Support
  • My Account
  • My Account
  • KEY FEATURES
    • Chart with Index Label
    • Multi Series Chart
    • Chart with Zooming & Panning
    • Synchronized Charts
    • Chart with Animation
    • Chart With Image Overlay
    • Chart with Secondary Axis
    • Chart with Null Data
    • Chart with Dynamic Data
    • Column Chart with Reversed Axis
    • Chart with Logarithmic Axis
    • Chart using JSON Data
    • Performance With 50,000 Data Points
    • Draggable Column Chart
    • Chart with Axis / Scale Break
    • Chart with Crosshair
    • Chart with Customized Legends
    • Drilldown Chart
    • Responsive Chart
    • Chart with Axis Labels & Ticks inside Plot Area
    • Sync ToolTip across Multiple Charts
  • LINE CHARTS
    • Line Chart
    • Dashed Line Chart
    • Multi Series Line Chart
    • Line Chart with Zoom and Pan
    • Line Chart with Data Marker
    • Line Chart with Logarithmic Axis
    • Line Chart with Axis / Scale Break
    • Line Chart with Multiple Axes
    • Spline Chart
    • Multi Series Spline Chart
    • Dynamic Spline Chart
    • Spline Chart with Secondary Axis
    • Spline Chart with Legends
    • Step Line Chart
    • Multi Series Step Line Chart with Null Data
  • AREA CHARTS
    • Area Chart
    • Multi Series Area Charts
    • Spline Area Chart
    • Multi Series Spline Area Charts
    • Step Area Chart
    • Range Area Chart
    • Multi Series Range Area Charts
    • Range Spline Area Chart
    • Stacked Area Chart
    • Stacked Area 100% Chart
    • Stacked Area 100% Chart with Date-Time Axis
  • COLUMN & BAR CHARTS
    • Column Chart
    • Column Charts with Multiple Axes
    • Bar Chart
    • Multi Series Bar Chart
    • Bar Chart with Axis / Scale Break
    • Range Column Chart
    • Multi Series Range Column Chart
    • Stacked Column Chart
    • Stacked Column 100% Chart
    • Range Bar Chart
    • Stacked Bar Chart
    • Stacked Bar 100% Chart
    • Waterfall Chart
    • Multi Series Waterfall Chart
    • Waterfall Chart with Custom Colors
  • PIE & FUNNEL CHARTS
    • Pie Chart
    • Pie Chart with Legends
    • Pie Chart with Custom Radius
    • Doughnut Chart
    • Doughnut Chart with Custom Inner Radius
    • Funnel Chart
    • Funnel Chart with Custom Neck
    • Inverted Funnel Chart
    • Pyramid Chart
    • Pyramid Chart with Values represented by Area
    • Pyramid Chart With Index Labels Placed Inside
  • FINANCIAL CHARTS
    • Candlestick Chart
    • Multi Series Candlestick Chart
    • Combination of Candlestick & Line Chart
    • OHLC Chart
    • OHLC Chart from JSON Data using AJAX
  • SCATTER & BUBBLE CHARTS
    • Scatter / Point Chart
    • Multi Series Scatter / Point Chart
    • Scatter Chart with Custom Markers
    • Bubble Chart
    • Bubble Chart with Zoom & Pan
    • Bubble Chart with Custom Markers
  • BOX & WHISKER CHARTS
    • Box And Whisker Chart
    • Box and Whisker Chart with Color Customization
    • Box And Whisker Chart with Outliers
  • COMBINATION CHARTS
    • Error Chart
    • Error Line Chart
    • Error Bar Chart
    • Pareto Chart
    • Pareto Chart with Index / Data Label
    • Combination of Range Area and Line Charts
    • Combination of Column, Line and Area Chart
    • Combination of OHLC and Line Chart
  • DYNAMIC CHARTS
    • Dynamic / Live Column Chart
    • Dynamic / Live Line Chart
    • Dynamic / Live Multi Series Chart
  • ANGULAR, REACT, VUE.JS, JQUERY
    • Angular Charts
    • React Charts
    • Vue.js Charts
    • jQuery Charts
  • SERVER SIDE TECHNOLOGIES
    • ASP.NET MVC Charts
    • PHP Charts
    • Python Charts
    • JSP Charts
    • Spring MVC Charts

Syncing Tooltip across Multiple JavaScript Charts & Graphs

Download JavaScript Chart Samples
  • JavaScript Chart Samples
  • React Chart Samples
  • Angular Chart Samples
  • Vue.js Chart Samples
  • jQuery Chart Samples
  • PHP Chart Samples
  • Python Django Chart Samples
  • ASP.NET Chart Samples
  • JSP Chart Samples
  • Spring MVC Chart Samples
  • Dashboard Samples
  • JavaScript StockChart Samples

Syncing ToolTip allows you to analyze related parameters across multiple charts in a page. Library provides APIs to easily do the same. Below example shows web analytics data with tooltip synced across charts.

Try Editing The Code

window.onload = function () {
  var charts = [];
  var axisX = {
    labelFormatter: function(){ return "";},
    tickLength: 0,
    lineThickness: 0
  }, 
  axisY = {
    labelFormatter: function(){ return "";},
    tickLength: 0,
    gridThickness: 0,
  };
  
  var newUserOptions = {
    animationEnabled: true,
    theme: "light2",
    title:{
      text: "New Users",
      fontSize: 18,
      verticalAlign: "bottom"
    },
    axisX: axisX,
    axisY: axisY,
    data: [{
      type: "splineArea", //change type to bar, line, area, pie, etc
      markerSize: 0,
      dataPoints: [
        { x: new Date(2018, 00, 01), y: 74553 },
        { x: new Date(2018, 01, 01), y: 75374 },
        { x: new Date(2018, 02, 01), y: 76065 },
        { x: new Date(2018, 03, 01), y: 76521 },
        { x: new Date(2018, 04, 01), y: 76695 },
        { x: new Date(2018, 05, 01), y: 76381 },
        { x: new Date(2018, 06, 01), y: 76693 },
        { x: new Date(2018, 07, 01), y: 75624 },
        { x: new Date(2018, 08, 01), y: 76367 },
        { x: new Date(2018, 09, 01), y: 75426 },
        { x: new Date(2018, 10, 01), y: 76024 },
        { x: new Date(2018, 11, 01), y: 75960 }
      ]
    }]
  }
  var bounceRateOptions = {
    animationEnabled: true,
    theme: "light2",
    title:{
      text: "Bounce Rate",
      fontSize: 18,
      verticalAlign: "bottom"
    },
    axisX: axisX,
    axisY: axisY,
    data: [{
      type: "splineArea", //change type to bar, line, area, pie, etc
      markerSize: 0,
      yValueFormatString: "#.##%",
      dataPoints: [
        { x: new Date(2018, 00, 01), y: 0.4731 },
        { x: new Date(2018, 01, 01), y: 0.4743 },
        { x: new Date(2018, 02, 01), y: 0.4760 },
        { x: new Date(2018, 03, 01), y: 0.4751 },
        { x: new Date(2018, 04, 01), y: 0.4757 },
        { x: new Date(2018, 05, 01), y: 0.4761 },
        { x: new Date(2018, 06, 01), y: 0.4768 },
        { x: new Date(2018, 07, 01), y: 0.4771 },
        { x: new Date(2018, 08, 01), y: 0.4773 },
        { x: new Date(2018, 09, 01), y: 0.4764 },
        { x: new Date(2018, 10, 01), y: 0.4757 },
        { x: new Date(2018, 11, 01), y: 0.4751 }
      ]
    }]
  }
  
  var pageViewsOptions = {
    animationEnabled: true,
    theme: "light2",
    title:{
      text: "Page Views",
      fontSize: 18,
      verticalAlign: "bottom"
    },
    axisX: axisX,
    axisY: axisY,
    data: [{
      type: "splineArea", //change type to bar, line, area, pie, etc
      markerSize: 0,
      dataPoints: [
        { x: new Date(2018, 00, 01), y: 897533 },
        { x: new Date(2018, 01, 01), y: 898699 },
        { x: new Date(2018, 02, 01), y: 900047 },
        { x: new Date(2018, 03, 01), y: 900348 },
        { x: new Date(2018, 04, 01), y: 900678 },
        { x: new Date(2018, 05, 01), y: 900407 },
        { x: new Date(2018, 06, 01), y: 900946 },
        { x: new Date(2018, 07, 01), y: 901937 },
        { x: new Date(2018, 08, 01), y: 902117 },
        { x: new Date(2018, 09, 01), y: 901936 },
        { x: new Date(2018, 10, 01), y: 903288 },
        { x: new Date(2018, 11, 01), y: 903107 }
      ]
    }]
  }

  var visitorsOptions = {
    animationEnabled: true,
    theme: "light2", // "light1", "light2", "dark1", "dark2"
    title:{
      text: "Total Website Visitors"
    },
    axisY: {
      labelFormatter: addSymbols
    },
    data: [{
      type: "column", //change type to bar, line, area, pie, etc
      color: "#6D78AD",
      dataPoints: [
        { x: new Date(2018, 00, 01), y: 130796 },
        { x: new Date(2018, 01, 01), y: 131774 },
        { x: new Date(2018, 02, 01), y: 132750 },
        { x: new Date(2018, 03, 01), y: 132850 },
        { x: new Date(2018, 04, 01), y: 133384 },
        { x: new Date(2018, 05, 01), y: 132607 },
        { x: new Date(2018, 06, 01), y: 132687 },
        { x: new Date(2018, 07, 01), y: 132443 },
        { x: new Date(2018, 08, 01), y: 133044 },
        { x: new Date(2018, 09, 01), y: 132095 },
        { x: new Date(2018, 10, 01), y: 132446 },
        { x: new Date(2018, 11, 01), y: 131648 }
      ]
    }]
  };

  charts.push(new CanvasJS.Chart("chartContainer1", visitorsOptions));
  charts.push(new CanvasJS.Chart("chartContainer2", newUserOptions));
  charts.push(new CanvasJS.Chart("chartContainer3", pageViewsOptions));
  charts.push(new CanvasJS.Chart("chartContainer4", bounceRateOptions));
  syncTooltip(charts);
  
  for( var i = 0; i < charts.length; i++){
    charts[i].render();
  }

  function syncTooltip(charts) {
    
    if(!this.onToolTipUpdated){
      this.onToolTipUpdated = function(e) {
        for (var j = 0; j < charts.length; j++) {
          if (charts[j] != e.chart)
            charts[j].toolTip.showAtX(e.entries[0].xValue);
        }
      }
    }

    if(!this.onToolTipHidden){
      this.onToolTipHidden = function(e) {
        for( var j = 0; j < charts.length; j++){
          if(charts[j] != e.chart)
            charts[j].toolTip.hide();
        }
      }
    }
    
    for(var i = 0; i < charts.length; i++) { 
        if(!charts[i].options.toolTip)
          charts[i].options.toolTip = {};

        charts[i].options.toolTip.updated = this.onToolTipUpdated;
        charts[i].options.toolTip.hidden = this.onToolTipHidden;
    }  
  }

  function addSymbols(e){
      var suffixes = ["", "K", "M", "B"];

      var order = Math.max(Math.floor(Math.log(Math.abs(e.value)) / Math.log(1000)), 0);
      if(order > suffixes.length - 1)
          order = suffixes.length - 1;

      var suffix = suffixes[order];
      return CanvasJS.formatNumber(e.value / Math.pow(1000, order)) + suffix;
  }
}                            

Chart Customizations

You can also sync Axis Range across multiple charts while zooming/panning using rangeChanging and rangeChanged events.

© fenopix
  • About Us
  • FAQs
  • Careers
  • Privacy Policy
Server Side Technologies
  • ASP.NET MVC Charts
  • PHP Charts
  • JSP Charts
  • Spring MVC Charts
Front End Technologies
  • JavaScript Charts
  • jQuery Charts
  • React Charts
  • Angular Charts
  • JavaScript StockCharts
Contact
  • Fenopix, Inc.
  • 2093 Philadelphia Pike,
  • #5678, Claymont,
  • Delaware 19703
  • United States Of America