If you want to disable option, use null
value, not empty string (''
). See: http://jsfiddle.net/Yrygy/133/
However I think that it would be better to add one if-else statement, instead of three one above another, see: http://jsfiddle.net/Yrygy/134/
var chartType = 1,
tooltip = {
valueSuffix: ''
};
if (chartType == 1) {
tooltip.pointFormat = '{series.name}: {point.y}';
tooltip.shared = true;
} else {
tooltip.shared = false;
tooltip.formatter = function () {
if (chartType == 2) {
return '' + this.point.tooltip + ': ' + (chartType == 2 ? this.y.toFixed(1) : this.y.toFixed(0));
} else {
return false;
}
}
}
And then create chart:
chart = new Highcharts.Chart({
tooltip: tooltip,
// other options
});