nandrianakis Posted June 4, 2018 Share Posted June 4, 2018 Good morning I need to display, client side, label, value, percent as tooltip on a pie chart Also on chart with 2 line series on mouseover on marker Any idea how can i do this? Rgs NA. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 4, 2018 Share Posted June 4, 2018 Hello, I need to display, client side, label, value, percent as tooltip on a pie chart Can you analyze, check this approach? UniChart -> ClientEvents -> UniEvents -> function chart.beforeInit(sender, config): function chart.beforeInit(sender, config) { config.series[0].tooltip = { trackMouse: true, width: 120, renderer: function(tip, item) { tip.setTitle(item.get('LL')); tip.update('Value: ' + item.get('A')); } } } Quote Link to comment Share on other sites More sharing options...
nandrianakis Posted June 4, 2018 Author Share Posted June 4, 2018 OK perfect Thank you Quote Link to comment Share on other sites More sharing options...
nandrianakis Posted June 4, 2018 Author Share Posted June 4, 2018 With 2 line series is working only for the series[0] with series[1] display values for series[0] attached demo Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 4, 2018 Share Posted June 4, 2018 Please attach a simple testcase Quote Link to comment Share on other sites More sharing options...
nandrianakis Posted June 4, 2018 Author Share Posted June 4, 2018 Project1.rar Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 4, 2018 Share Posted June 4, 2018 With 2 line series is working only for the series[0] with series[1] display values for series[0] attached demo A, B, C, .... For the second series use "B": function chart.beforeInit(sender, config) { config.series[1].tooltip = { trackMouse: true, width: 120, renderer: function(tip, item) { tip.setTitle(item.get('LL')); tip.update('Αγορές: ' + item.get('B')); } } } Quote Link to comment Share on other sites More sharing options...
nandrianakis Posted June 5, 2018 Author Share Posted June 5, 2018 OK this works But i have some questions what 'LL' means? what more options are with item.get('something')? where can i found the documentation? Thanks Quote Link to comment Share on other sites More sharing options...
nandrianakis Posted June 7, 2018 Author Share Posted June 7, 2018 Goog Morning Anything about my question? I need also the Series title, and the percent of the pie chart thanks NA. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 7, 2018 Share Posted June 7, 2018 Goog Morning, Sorry, can you please explain in more detail what you wanted ? Quote Link to comment Share on other sites More sharing options...
nandrianakis Posted June 7, 2018 Author Share Posted June 7, 2018 In your code renderer: function(tip, item) { tip.setTitle(item.get('LL')); tip.update('Αγορές: ' + item.get('B')); } the parameter item has the get method with parameter 'LL' 'A' etc. What other options there are for this parameter? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 7, 2018 Share Posted June 7, 2018 Well, the get method parameters can only be: LL - XLabel value YValues: A - Series0 B - Series1 C - Series2 ... Quote Link to comment Share on other sites More sharing options...
nandrianakis Posted June 7, 2018 Author Share Posted June 7, 2018 Thank you OK i need also to display in tooltip the title of the series as appear in legend Is this possible? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 7, 2018 Share Posted June 7, 2018 OK i need also to display in tooltip the title of the series as appear in legend Is this possible? Do you want like this?!: function chart.beforeInit(sender, config) { config.series[1].tooltip = { trackMouse: true, width: 120, renderer: function(tip, item) { tip.setTitle(this.getTitle() + ': ' + item.get('LL')); tip.update('Αγορές: ' + item.get('B')); } }; } Quote Link to comment Share on other sites More sharing options...
nandrianakis Posted June 7, 2018 Author Share Posted June 7, 2018 Exactly Thank you Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 14, 2018 Share Posted June 14, 2018 Solution for a "Stacked Bar": function chart.beforeInit(sender, config) { config.series[0].tooltip = { trackMouse: true, width: 120, renderer: function(tip, items, item) { tip.setTitle(this.getTitle()[items.getFields().map(function(obj){return obj.name;}).indexOf(item.field)-1] + ': ' + items.get('LL')); tip.update('Value: ' + items.get(item.field)); } }; } Quote Link to comment Share on other sites More sharing options...
nandrianakis Posted July 31, 2018 Author Share Posted July 31, 2018 Good morning I need also to display the percent in tooltip(clientside). Is this possible? Rgs Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 31, 2018 Share Posted July 31, 2018 Hi, Can you explain in more detail what you wanted ? Quote Link to comment Share on other sites More sharing options...
nandrianakis Posted July 31, 2018 Author Share Posted July 31, 2018 I am using to display tooltip this: function chart.beforeInit(sender, config) { config.series[0].tooltip = { trackMouse: true, width: 120, renderer: function(tip, item) { tip.setTitle(item.get('LL')); tip.update('<b>' + Ext.util.Format.number(item.get('A').toFixed(2),'0,000.00')+'</b>'); } } } I need also to show the percent for example if the title is 2015 and value is 10000 and that is 25% of the total Display something like this 2015 10,0000.00(25%) Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 31, 2018 Share Posted July 31, 2018 Ok I will check... Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 31, 2018 Share Posted July 31, 2018 And once again I'm sorry, How do you calculate the total value? Quote Link to comment Share on other sites More sharing options...
nandrianakis Posted July 31, 2018 Author Share Posted July 31, 2018 I dont know. Thats the problem I supposed that pie chart must have a property with the percent of each value Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 31, 2018 Share Posted July 31, 2018 Try this: function chart.beforeInit(sender, config) { config.series[0].tooltip = { trackMouse: true, width: 120, renderer: function(tip, item) { tip.setTitle(item.get('LL')); tip.update('<b>' + Ext.util.Format.number(item.get('A').toFixed(2), '0,000.00') + ' (' + ((item.get('A') / sender.store.max('A')) * 100).toFixed(2) + ' %)' + '</b>'); } } } Quote Link to comment Share on other sites More sharing options...
nandrianakis Posted August 1, 2018 Author Share Posted August 1, 2018 Ok this is working ecxept that you must change sender.store.max('A') to sender.store.sum('A') Thanks a lot Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 1, 2018 Share Posted August 1, 2018 Ah sorry, if the total, yes, "sum" Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.