gpt4 book ai didi

Flot xaxis 刻度未显示

转载 作者:行者123 更新时间:2023-12-04 00:40:19 26 4
gpt4 key购买 nike

好的,我有一个显示一些信息的 flot 堆叠条形图,现在除了 x 轴外,这一切都完美无缺。

目前,它没有显示我希望它显示的数据,而是在每隔一列显示一个列号。

下面是我的 xaxis 代码:

 var options = {
series: {stack: 0,
lines: {show: false, steps: false },
bars: {show: true, barWidth: 0.5, align: 'center',},},
xaxis: {ticks: [[1,' Yesterday'], [2,'Two'], [3,'Three'], [4,'Four'], [5,'Five'], [6,'Six'], [7,'Seven'], [8,'Eight'], [9,'Nine'], [10,'Ten'], [11,'Eleven'], [12,'Twelve'], [13,'Thirteen'], [14,'fourteen']]},
xaxis: { tickColor: 'transparent' }
};

$.plot($(css_id), data, options);
});

这里是配置部分:

  xaxis: {
show: true, // null = auto-detect, true = always, false = never
position: "bottom", // or "top"
mode: null, // null or "time"
color: "#990000", // base color, labels, ticks
tickColor: null, // possibly different color of ticks, e.g. "rgba(0,0,0,0.15)"
transform: null, // null or f: number -> number to transform axis
inverseTransform: null, // if transform is set, this should be the inverse function
min: null, // min. value to show, null means set automatically
max: null, // max. value to show, null means set automatically
autoscaleMargin: null, // margin in % to add if auto-setting min/max
ticks: null, // either [1, 3] or [[1, "a"], 3] or (fn: axis info -> ticks) or app. number of ticks for auto-ticks
tickFormatter: null, // fn: number -> string
labelWidth: null, // size of tick labels in pixels
labelHeight: null,
reserveSpace: null, // whether to reserve space even if axis isn't shown
tickLength: null, // size in pixels of ticks, or "full" for whole line
alignTicksWithAxis: null, // axis number or null for no sync

// mode specific options
tickDecimals: null, // no. of decimals, null means auto
tickSize: null, // number or [number, "unit"]
minTickSize: null, // number or [number, "unit"]
monthNames: null, // list of names of months
timeformat: null, // format string to use
twelveHourClock: false // 12 or 24 time in time mode
},

我已经尝试更改几乎所有内容并查看了不同的帖子,但似乎没有任何内容可以更改值。我可以做一些简单的事情,比如改变颜色等,所以我想知道我是否做错了什么。

如有任何建议,我们将不胜感激。

谢谢

最佳答案

您已将 xaxis 配置加倍,因此第二个会覆盖第一个。

这个:

xaxis: {ticks: [[1,' Yesterday'], [2,'Two'], [3,'Three'], [4,'Four'], [5,'Five'], [6,'Six'], [7,'Seven'], [8,'Eight'], [9,'Nine'], [10,'Ten'], [11,'Eleven'], [12,'Twelve'], [13,'Thirteen'], [14,'fourteen']]},
xaxis: { tickColor: 'transparent' }

应该是:

xaxis: {
ticks: [[1,' Yesterday'], [2,'Two'], [3,'Three'], [4,'Four'], [5,'Five'], [6,'Six'], [7,'Seven'], [8,'Eight'], [9,'Nine'], [10,'Ten'], [11,'Eleven'], [12,'Twelve'], [13,'Thirteen'], [14,'fourteen']],
tickColor: 'transparent'
},

关于Flot xaxis 刻度未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19493038/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com