nandrianakis Posted June 4, 2018 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
Sherzod Posted June 4, 2018 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
nandrianakis Posted June 4, 2018 Author 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
Sherzod Posted June 4, 2018 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
nandrianakis Posted June 5, 2018 Author 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
nandrianakis Posted June 7, 2018 Author 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
Sherzod Posted June 7, 2018 Posted June 7, 2018 Goog Morning, Sorry, can you please explain in more detail what you wanted ? Quote
nandrianakis Posted June 7, 2018 Author 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
Sherzod Posted June 7, 2018 Posted June 7, 2018 Well, the get method parameters can only be: LL - XLabel value YValues: A - Series0 B - Series1 C - Series2 ... Quote
nandrianakis Posted June 7, 2018 Author 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
Sherzod Posted June 7, 2018 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
Sherzod Posted June 14, 2018 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
nandrianakis Posted July 31, 2018 Author Posted July 31, 2018 Good morning I need also to display the percent in tooltip(clientside). Is this possible? Rgs Quote
Sherzod Posted July 31, 2018 Posted July 31, 2018 Hi, Can you explain in more detail what you wanted ? Quote
nandrianakis Posted July 31, 2018 Author 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
Sherzod Posted July 31, 2018 Posted July 31, 2018 And once again I'm sorry, How do you calculate the total value? Quote
nandrianakis Posted July 31, 2018 Author 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
Sherzod Posted July 31, 2018 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
nandrianakis Posted August 1, 2018 Author 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
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.