水平条形图忽略tickInterval,最小和最大选项 [英] Horizontal Bar Chart Ignores tickInterval, min and max Options

查看:76
本文介绍了水平条形图忽略tickInterval,最小和最大选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在将jqPlot用于我所从事的项目,到目前为止,我对此感到非常满意.很完整.但是,我现在正在使用的功能需要水平条形图.我的问题是我的图表当前将xaxis刻度显示为十进制数字,增加了0.5.我不需要十进制值.我需要将整数增加1.我的配置有点像这样:

I have been using jqPlot for a project I am in and so far I am quite satisfied with it. Is very complete. However, the feature I am working on right now requires an horizontal bar chart. My issue is that my chart currently shows xaxis ticks as decimal numbers increasing by 0.5. I don't need decimal values. I need integers increasing by 1. My config is a little something like this:

var chartConfig = {
    seriesDefaults: {
        showMarker: false,
        shadowAngle: 135,
        pointLabels: {
            show: true,
            labelsFromSeries: true,
            seriesLabelIndex: 2,
            edgeTolerance: -50
        },
        renderer: $.jqplot.BarRenderer,
        rendererOptions: {
            barWidth: 25,
            barPadding: 0,
            barDirection: 'horizontal'
        }
    },
    axes: {
        xaxis: {
            min: 0,
            max: 4,
            tickInterval: 1
        },
        yaxis: {
            showTicks: true,
            renderer: $.jqplot.CategoryAxisRenderer,
            tickRenderer: $.jqplot.CanvasAxisTickRenderer,
            tickOptions: {
                angle: -50,
                labelPosition: 'middle'
            }
        }
    }
};

但是,jqPlot似乎完全忽略了xaxis tickInterval,min和max选项值.我的输出图表如下:

However, looks like jqPlot is completely ignoring the xaxis tickInterval, min and max option values. My output chart looks as follows:

我需要知道我在这里做的不好.我的配置看起来还可以,但是我无法让jqPlot使用我为X轴传递的值.在此问题上的任何帮助将不胜感激.

I need to know what I am doing bad here. My config looks to be okay, but I can't get jqPlot to use the values I pass for the X axis. Any help on this matter will be very much appreciated.

谢谢.

推荐答案

我在单杠上的tickInterval也遇到了问题.我发现您必须为所需的轴指定最小和最大以及刻度间隔.

I have been having problem with the tickInterval on horizontal bars also. I found that you have to specify both the min and max along with the tick interval for the axis you need it for.

您已经完成了此操作,但是我想在某个地方说明一下,因为我花了很长时间试图找出为什么滴答间隔不起作用,并且该帖子不断出现在我的搜索中,希望对其他人有所帮助.

This you have done but I wanted to state this somewhere as I spent a long time trying to find why tick interval wasn't working and this post kept coming up in my searches so hopefully it will help others.

对于您的问题,可能与您的数据集有关.

For your issue, is possibly something to do with your data sets.

如果这仍然导致您遇到问题,则可以将完整的脚本和您的值一起发布,因为代码只是部分atm.

If this is still causing you problems maybe post the full script with your values as the code is only partial atm.

谢谢

理查德

这篇关于水平条形图忽略tickInterval,最小和最大选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆