【问题标题】:Flotcharts barChart first and last bar cut off [duplicate]Flotcharts barChart第一个和最后一个条被切断[重复]
【发布时间】:2015-11-10 11:31:43
【问题描述】:

我正在使用 Flot Charts 和 AngularJs 的组合来显示条形图。 最初,该图表被创建为折线图。 条形图采用时间模式,显示的数据以时间戳链接。

图表选项:

$scope.chartOptions = {
    series : {
        bars: {
            show: true, 
            barWidth: 60*60*60*60,
            align: 'center'
        }
    },
    grid : {
        borderColor : '#eee',
        borderWidth : 1,
        backgroundColor: null,
        clickable: true
    },
    yaxis:{
        minTickSize: 0, 
        tickDecimals: 0
    },
    xaxis: {
        mode: "time",
        tickSize: [1, 'day'],
        timeformat: "%d %b",
        minTickSize: 7,
        timezone: 'browser'
    },
    shadowSize : 0
};

图表数据:

[[1445814000000,3],[1445900400000,3],[1445986800000,15],[1446073200000,9]]

图表显示如下: http://puu.sh/lgi6e/83f61cbf8c.png

我怎样才能完全显示第一个(和最后一个)栏?

【问题讨论】:

    标签: javascript angularjs bar-chart flot


    【解决方案1】:

    我无法评论,所以我会回答!

    当我将您提供的代码插入 Flot 时,它运行良好,该图显示了左侧的完整条,我在这里创建了一个快速 Fiddle:http://fiddle.jshell.net/6xpLey6e/1/ 并使用 IE 和 Chrome 进行了检查。

    [将条形宽度更改为条形宽度:24 * 60 * 60 * 1000,对于全宽条形]

    一定有别的东西在起作用。

    【讨论】:

    • 感谢您的回答!设置 xaxis min 和 max 属性会导致问题。我后来用一周的开始和结束时间戳设置了这些属性。
    猜你喜欢
    • 2023-04-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-13
    • 2021-07-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多