Jump to content

TUniChart Series Mouse Move and hint (tooltips)


Recommended Posts

I've 4 Series series in UniChart, with data for 4 years, each one is 1 year. (for anything type: area, bar, pie, scatter, radar, etc.)
When mouse move over the series, and values triggers 

SeriesMouseOver(Sender: TUniCustomChart; Series: TUniChartSeries; Index: Integer; Value: Variant; X, Y, PageX,   PageY: Integer);

But always the series and Index are same, never changes. Only first serie is recognizing. I need the others too.!
 

I try with tooltips in javascript (from Delphi):

//graphic1 is TuniChart component

    graphic1.ClientEvents.UniEvents.Add(
        'chart.beforeInit=function chart.beforeInit(sender, config){'+
        '  config.innerPadding = {left: 4,right: 5};'+
        '  if (config.series.length) { '+
        '    for (i = 0; i < config.series.length; i++) {'+
        '      config.series[i].tooltip = {'+
        '        trackMouse: true,'+
        '        width: 150,'+
        '        renderer: function(tip, item) {'+
        '          tip.setTitle(item.get(''LL''));'+
        '          tip.update(''Valor: '' + item.get(String.fromCharCode(65+i)));'+
        '        }'+
        '      }'+
        '    }'+
        '  }'+
        '}');                                          

But when mouse moves over the graphic... only values from 1 serie shows, and same value when moving over anothers series.

How can catch de current serie and current value?


 


 

Link to post
Share on other sites
  • 3 months later...
  • 1 month later...

 

I discovered the solution

function chart.beforeInit(sender, config)
{
   if (config.series.length) { 
       for (i = 0; i < config.series.length; i++) {
         config.series.tooltip = {
           trackMouse: true,
           width: 150,
           renderer: function(tip, item) {
              tip.setTitle(item.get('LL'));
              tip.update('Quantidade: ' + item.get('A'));
              console.log(item);
            }
         }
       }
   }

}

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...