【问题标题】:jqplot CategoryAxisRenderer highlighter wrong tooltip outputjqplot CategoryAxisRenderer 荧光笔错误的工具提示输出
【发布时间】:2014-02-07 12:19:06
【问题描述】:

我正在使用 jqplot 1.0.8 并遇到CategoryAxisRenderer 的问题。 y 轴显示数值,x 轴显示数值或字符串值。这就是我选择CategoryAxisRenderer 的原因。基本上,除了highlighter 之外,一切都正确呈现。如果我将鼠标悬停在一个点上,我不会得到 x 轴的值,而是只会得到值的 index

初始化

PLOT = $.jqplot(that.getId() + '-CONTENT', [array], {
    width: $('#' + elemId).width() - 30,
    height: 500,
    axesDefaults: {
        tickRenderer: $.jqplot.CanvasAxisTickRenderer ,
    },
    axes: {
        xaxis: {
            renderer: $.jqplot.CategoryAxisRenderer,
            tickOptions: {
                angle: -90,
                fontSize: '8pt'
            }
        },
        yaxis:{
            min:1
        }
    },
    highlighter: {
        show: true,
        tooltipLocation: 'ne',
        sizeAdjust: 7.5,
        useAxesFormatters: false,
        formatString: '%s, %d'
    },
    cursor: {
        show: false
    }
});

输出

预期结果

1) 1978, 1

2) 卢布尔雅那大学,37

【问题讨论】:

    标签: jqplot diagram axes renderer jqplot-highlighter


    【解决方案1】:

    我遇到了完全相同的问题,我自己的解决方案是使用 tooltipContentEditor 自定义工具提示。

    highlighter: {
                tooltipContentEditor: function (str, seriesIndex, pointIndex, plot) {
                    var content = plot.axes.xaxis.ticks[pointIndex] + ", " + str.split(',')[1];
                    return content;
                }
            },
    

    【讨论】:

      【解决方案2】:

      如果要显示分类的 x 轴值,则必须遵循以下解决方法:https://groups.google.com/d/msg/jqplot-users/ZeXgxATxMyI/Fs3DnBAecu0J

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-01-04
        • 1970-01-01
        • 2023-03-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多