Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

251
Views
Rickshaw.js How to display other information in a tooltip (HoverDetail)?

I have the following code

var rs2 = new Rickshaw.Graph({
   element: document.querySelector('#rs2'),
   renderer: 'area',
   stroke: true,
   interpolation: 'basis',
      
   series: [{
     data: series_TOTAL,
     color: 'yellow',
   }]
});
rs2.render();
var hoverDetail = new Rickshaw.Graph.HoverDetail({
   graph: rs2,
   formatter: function(series, x, y, z) {
   var date = '<span class="date"><center>' + unixToHour(x) + '</center></span>';
   var swatch = '<span class="detail_swatch" style="background-color: ' + series.color + '"></span>';
   var price = '<span class="date"><center>' + z + '€</center></span>';
   var content = swatch + Math.round(parseFloat(y) * 10) / 10 + ' Watts<br>' + date + price;
   return content;

   }
});

series_TOTAL looks like this:

[{"x": 1638983953,"y": 159,"z": 0.0454882},{"x":38983953,"y": 159,"z": 0.0457761},...]

I don't know how to reference z inside the tooltip so that it returns the value. Currently z returns something like "Wed, 08 Dec 2021 16:35:05 GMT".

In the above code, if I change z for series.data[n].z, it returns the value I want but since series.data is an array, I don't know how to obtain n so that it shows the value corresponding to the part of the graph I'm hovering.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!