Customozed Tool tip

TeeChart for JavaScript for the HTML5 Canvas
Post Reply
SenSeo
Newbie
Newbie
Posts: 71
Joined: Wed Mar 09, 2016 12:00 am

Customozed Tool tip

Post by SenSeo » Tue May 10, 2016 12:54 pm

As per my requirement I need to show the tooltip with values, datetime (x-axis value) and some comment on the chart. I am able to get the value of the chart but not datetime value. Can you please guide me how I can get datetime value using below code?

Code: Select all

       tip.ongettext = function (tool, text, series, index) {
                  
                        var s = 'Series1 point: <strong>' + index.toFixed(0) + '</strong><br/>Value: ' + series.data.values[index].toFixed(2);

return s;
}

Yeray
Site Admin
Site Admin
Posts: 9622
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Customozed Tool tip

Post by Yeray » Wed May 11, 2016 2:46 pm

Hello,

Having your DateTime values in your series data.x array, you can take that and format it as follows:

Code: Select all

  tip.ongettext = function (tool, text, series, index) {
    var s = 'Series1 point:' + index.toFixed(0) + ' X Value: ' + new Date(series.data.x[index]).toDateString();
    return s;
  }
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply