如何始终使用 jQuery 迷你图显示两位小数?
How can I always show two decimal places with jQuery sparklines?
如何在迷你图工具提示中显示始终包含两位小数的值?
例如,我希望 1.20 显示为“1.20”而不是“1.2”?
找到解决方案:
迷你图有选项:tooltipFormat,您可以在其中格式化工具提示。
var sparklineCharts = function(){
$('#my_id').sparkline(currentMonthArray, sparklineSettings);
};
var sparklineSettings = {
type: 'line',
width: '100%',
height: '50',
lineColor: '#1ab394',
fillColor: 'transparent',
tooltipFormat: '{{y.2}}'
};
如何在迷你图工具提示中显示始终包含两位小数的值? 例如,我希望 1.20 显示为“1.20”而不是“1.2”?
找到解决方案: 迷你图有选项:tooltipFormat,您可以在其中格式化工具提示。
var sparklineCharts = function(){
$('#my_id').sparkline(currentMonthArray, sparklineSettings);
};
var sparklineSettings = {
type: 'line',
width: '100%',
height: '50',
lineColor: '#1ab394',
fillColor: 'transparent',
tooltipFormat: '{{y.2}}'
};