質問

An issue I have noticed when you put two charts side by side in highcharts is that the tooltip function will work for the first chart but not the other. My guess that is that although the charts "look" like they are next to each other ... but in fact chart 1 is actually on top of chart 2. A good example of this is as follows: http://jsfiddle.net/F3pts/7/

Other example that will yield the same issue:

var options = {
    chart: {
        renderTo: 'container',
        animation: true
    },
    xAxis: [{
        type: 'datetime',
        width :320,

    }, {
        type: 'datetime',
        offset: 0,
        width :200,
        left: 380
    }],

    yAxis: [{
        lineWidth: 2,
        offset: 0,
        tooltip: {
            enabled: true,
            formatter: function () {
                return this.value;
            }
        }
    },
           ],

    series: [{
        xAxis: 0,
        name: 'Some line',
        data: [
                [Date.UTC(2010, 0, 1), 3],
                [Date.UTC(2010, 0, 2), 7],
                [Date.UTC(2010, 0, 3), 5],
                [Date.UTC(2010, 0, 6), 6],
                [Date.UTC(2010, 0, 7), 4],
                [Date.UTC(2010, 0, 8), 5]
        ],
    }, {
        name: 'bar1',
        xAxis: 1,
        data: [

                [Date.UTC(2010, 0, 1), 5],
                [Date.UTC(2010, 0, 2), 6],
                [Date.UTC(2010, 0, 3), 7],
                [Date.UTC(2010, 0, 6), 4],
                [Date.UTC(2010, 0, 7), 3],
                [Date.UTC(2010, 0, 8), 4]

        ],

    }, {
        name: 'bar2',
        xAxis: 1,
        data: [
                [Date.UTC(2010, 0, 1), 5],
                [Date.UTC(2010, 0, 2), 8],
                [Date.UTC(2010, 0, 3), 5],
                [Date.UTC(2010, 0, 6), 6],
                [Date.UTC(2010, 0, 7), 4],
                [Date.UTC(2010, 0, 8), 3]
        ],
    }]
};

var chart = new Highcharts.Chart(options);

Any ideas as to how ALL tooltips can be displayed? Kinda defeats the purpose if only one of these is available...

Regards and thanks for your time

役に立ちましたか?

解決

Tooltip doesn't work, because of missconfigured chart:

tooltip: {
    pointFormat: function () {
        return "";
    }
},

pointFormat should be string, not a function.

Anyway, there is stil la problem with tooltip position, see #2062.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top