javascript - jqplot 缩放功能不起作用

标签 javascript jquery jqplot

我想用 jqplot 在浏览器中可视化一些时间序列数据。我的问题是,x 轴值重叠并且不可读。

因此,缩放功能将非常有用。但它不起作用。

请看一下 fiddle ,它不能在 Firefox 上运行,只能在谷歌浏览器上运行:

http://jsbin.com/onufih/9/edit

这是我的代码:

function getTicks() {

    var ticks = [];

    for (var i = 0; i < data.length; i++) {
        var item = data[i];
        var dateStr = item[0];
        ticks.push(dateStr);
    }

    return ticks;
}

var overviewChart = $.jqplot('overviewChart', [data], {
    title: 'Rotated Axis Text',
    axes: {
        xaxis: {
            renderer: $.jqplot.DateAxisRenderer,
            rendererOptions: {
                tickRenderer: $.jqplot.CanvasAxisTickRenderer
            },
            ticks: getTicks(),
            tickOptions: {

                formatString: '%#m/%#d/%y - %#H h - %#M m - %#S s',
                fontSize: '10pt',
                fontFamily: 'Tahoma',
                angle: -40
            }
        },
        yaxis: {
            rendererOptions: {
                tickRenderer: $.jqplot.CanvasAxisTickRenderer
            },
            tickOptions: {
                fontSize: '10pt',
                fontFamily: 'Tahoma',
                angle: 30
            }
        }
    },
    series: [{
        lineWidth: 4,
        markerOptions: {
            style: 'square'
        }
    }],
    cursor: {
        zoom: true,
        looseZoom: true
    }
});

最佳答案

您需要将 show: true 添加到您的光标,如 this example .

关于javascript - jqplot 缩放功能不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16874867/

相关文章:

javascript - 在 SVG 中捕获设置属性事件?

javascript - jqPlot 折线图未绘制到 div 边缘

javascript - 选定的选项从 php 中的数据库获取数据

javascript - 带有外部库的 Jsfiddle,Font Awesome 不渲染,同位素不切换布局

jqplot - 如何确保标记不会在 jqplot 中被截断

Jquery从django对象构造数组

javascript - 使用node.js fs.writeFile写入二进制数据来创建镜像文件

javascript - 在 jqGrid 内联编辑中获取选择的文本部分而不是值

javascript - FlatList 不会在 React-Native 中渲染任何文本

javascript - 如何在过滤器中添加/删除类 jQuery?