简体   繁体   English

悬停指针在AmCharts股票图表中不起作用

[英]Hover hand pointer not working in AmCharts Stock chart

I have two graphs displayed using AmChart. 我有两个图表使用AmChart显示。 On hover pointer displays for one, but doesn't work for another. 在鼠标悬停时,指针显示为一个,但对另一个不起作用。 On hover working for first dataset graph when hovered hover the round pointer but it doesnt work for the second data set graph. 悬停时,将鼠标悬停在第一个数据集图上时,将鼠标指针停在圆形指针上,但不适用于第二个数据集图。 I'm using the showHandOnHover property but still not working. 我正在使用showHandOnHover属性,但仍无法正常工作。 DEMO Here is the code: 演示这是代码:

var chartData1 = [];
var chartData2 = [];

generateChartData();

function generateChartData() {
    var firstDate = new Date();
    firstDate.setDate(firstDate.getDate() - 500);
    firstDate.setHours(0, 0, 0, 0);

    for (var i = 0; i < 500; i++) {
        var newDate = new Date(firstDate);
        newDate.setDate(newDate.getDate() + i);

        var a1 = Math.round(Math.random() * (40 + i)) + 100 + i;
        var a2 = -1 * Math.round(Math.random() * (100 + i)) + 200 + i;

        chartData1.push({
            date: newDate,
            value: a1
        });
        chartData2.push({
            date: newDate,
            value: a2
        });
    }
}

AmCharts.makeChart("chartdiv", {
    type: "stock",

    dataSets: [{
            title: "first data set",
            fieldMappings: [{
                fromField: "value",
                toField: "value"
            }],
            dataProvider: chartData1,
            categoryField: "date"
        },

        {
            title: "second data set",
            fieldMappings: [{
                fromField: "value",
                toField: "value2"
            }],
            dataProvider: chartData2,
            categoryField: "date",
            compared: true
        }
    ],

    panels: [{

            showCategoryAxis: false,
            title: "Data set #1",
            recalculateToPercents: "never",
            stockGraphs: [{
                id: "g1",
                valueField: "value",
        bullet: 'round',
        showHandOnHover: true,
                comparable: true
            }],

            stockLegend: {

            }
        }, {

            showCategoryAxis: true,
            title: "Data set #2",
            recalculateToPercents: "never",
            stockGraphs: [{
                id: "g2",
                valueField: "value2",
        compareGraphBullet: 'round',
        compareGraphShowHandOnHover: true,
                compareField: "value2",
                comparable: true,
                visibleInLegend: false
            }],

            stockLegend: {

            }
        }
    ],

    chartScrollbarSettings: {
        graph: "g1"
    },

    chartCursorSettings: {
        valueBalloonsEnabled: true,
        fullWidth:true,
        cursorAlpha:0.1
    },

    periodSelector: {
        periods: [{
            period: "MM",
            selected: true,
            count: 1,
            label: "1 month"
        }, {
            period: "YYYY",
            count: 1,
            label: "1 year"
        }, {
            period: "YTD",
            label: "YTD"
        }, {
            period: "MAX",
            label: "MAX"
        }]
    }
});

您是否尝试仅在样式表中添加circle {cursor: pointer}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM