-
-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tooltip not works with e_flip_coords #79
Comments
Now formatter code looks like this: function(params, ticket, callback) {
var locale = "ru-RU";
var opts = {
"style":"decimal",
"minimumFractionDigits":0,
"maximumFractionDigits":0,
"currency":"RUB"
};
var fmt = new Intl.NumberFormat(locale, opts);
return params.name + '<br>' +
params.marker + ' ' +
params.seriesName + ': ' +
fmt.format(parseFloat(params.value[1]));
} To solve this issue we should swap the function(params, ticket, callback) {
var locale = "ru-RU";
var opts = {
"style":"decimal",
"minimumFractionDigits":0,
"maximumFractionDigits":0,
"currency":"RUB"
};
var fmt = new Intl.NumberFormat(locale, opts);
return params.name + '<br>' +
params.marker + ' ' +
params.seriesName + ': ' +
fmt.format(parseFloat(params.value[0]));
} |
@JohnCoene, so seems I find robust way to detect it: function(params, ticket, callback) {
var locale = "ru-RU";
var opts = {
"style":"decimal",
"minimumFractionDigits":0,
"maximumFractionDigits":0,
"currency":"RUB"
};
var fmt = new Intl.NumberFormat(locale, opts);
var idx = 0;
if (params.name == params.value[0]) {
idx = 1;
}
return params.name + '<br>' +
params.marker + ' ' +
params.seriesName + ': ' +
fmt.format(parseFloat(params.value[idx]));
} |
Note with option = {
dataset: [{
id: "cars",
source: {
"model":["Toyota Corolla","Fiat 128","Honda Civic","Lotus Europa","Fiat X1-9"],
"total":[53.8,51.87,48.92,47.3,46.2],
"mpg":[33.9,32.4,30.4,30.4,27.3]
}
}],
xAxis: {show: true, type: 'value'},
yAxis: {show: true, type: 'category'},
tooltip: {show: true},
series: [
{
type: 'bar',
stack: 'grp',
encode: {
y: 'model',
x: 'total',
tooltip: 'total'
},
},
{
type: 'bar',
stack: 'grp',
encode: {
y: 'model',
x: 'mpg',
tooltip: 'mpg'
}
}
]
}; To flip coordinates we must simply swap the encode and axis types. |
Thanks @artemklevtsov, I'll look into this tomorrow! |
Hi.
Plots with
e_flip_coords
not shows tooltips.To reproduce:
The text was updated successfully, but these errors were encountered: