gpt4 book ai didi

javascript - 删除第一个点和最后一个点之间的线 (line-chart/flot.js)

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:39:44 24 4
gpt4 key购买 nike

我怎样才能删除第一个点和最后一个点之间的链接,我尝试了很多方法但没有任何反应

我试着用谷歌搜索它,但我发现了数学实验室的问题!

图表图片:

Chart image

我的图表代码

<script type="text/javascript">
<?php $counter_days = 1;?>
var ticks = [
@foreach($numbers_of_visitors_last_10_days as $keys=>$dates )
@if($counter_days <=1)
[{{ltrim($keys,'0')}}, "days {{ltrim($keys,'0')}}"],
@else
[{{ltrim($keys,'0')}},{{ltrim($keys,'0')}}],
@endif
<?php $counter_days ++;?>
@endforeach
];

/*
* LINE CHART
* ----------
*/
$(function () {
"use strict";

var line_data2 = [

@foreach($numbers_of_visitors_last_10_days as $keys=>$dates )
[{{ltrim($keys,'0')}}, {{count($dates)}}],
@endforeach
];
var xaxisLabel = $("<div class='axisLabel xaxisLabel'></div>")
.text("My X Label")
.appendTo($('#line-chart'));

$.plot("#line-chart", [line_data2], {

grid: {
hoverable: true,
borderColor: "#E2E6EE",
borderWidth: 1,
tickColor: "#E2E6EE"
},


series: {
shadowSize: 2,
lines: {
show: true
},
points: {
show: true
}
},
colors: ["#333333", "#cccccc"],
lines: {
fill: true,
},
yaxis: {
show: true,
tickFormatter: function (val, axis) { return val }


},
xaxis: {
show: true,
ticks: ticks,


}

});


});


</script>

正如你在图片中看到的,第一行与最后一行相连,这让它看起来很奇怪且不可读

这可能吗?

最佳答案

Here dellitsa 写道:

Hi, I had the same issue when I was plotting with dates. It's not the library's problem. Your data are not in the correct order. Try adding order by date to your query and the plot will be fine.

这实际上适用于我的问题 - 但它有点不同,由于我的 SQL 中的错误,我将系列相乘,因此相同的数据在该数组中一遍又一遍地重复,导致效果“错误的顺序”。

关于javascript - 删除第一个点和最后一个点之间的线 (line-chart/flot.js),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48608566/

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