簡體   English   中英

刪除浮動圖表上的刻度線

[英]Remove the tick bar on flot charts

是否可以刪除浮動圖表上x和y軸上的刻度線?

我目前所擁有的圖片

我想刪除兩個系列標簽之間的灰色條

您是否嘗試過配置軸,例如:

xaxis: {
  tickLength: 0
}

yaxis: {
  tickLength: 0
}

參考這里

更新以回應您的最后評論

由於沒有此類選項,因此一種可能的解決方法是將刻度欄的顏色設置為與圖表背景相同的顏色,以及將刻度線設置為與現在一樣的顏色。

xaxis: {   
  color: /* same as your background color */
  tickColor: /* different color, like the grayish one you have for the ticks */
}

yaxis: {   
  color: /* same as your background color */
  tickColor: /* different color, like the grayish one you have for the ticks */
}

希望能幫助到你

我最終更改了flot源代碼以允許發生這種情況。

這就是我所做的。

1)在x / yaxis選項中添加了“ tickBar”。 (如果為true,則顯示tickBar。默認值:true)2)更改drawGrid函數以使用此選項

drawGrid()
...

//draw the ticks
axes = allAxes();
bw = options.grid.borderWidth;
xBar = (options.xaxis.tickBar !== undefined)? options.xaxis.tickBar:true; //new
yBar = (options.yaxis.tickBar !== undefined)? options.yaxis.tickBar:true; //new

...

if(!axis.innermost){
ctx.strokeStyle = axis.options.color;
ctx.beginPath();
xoff = yoff = 0;
if(axis.direction == "x"){
    if(xBar) //new
        xoff = plotWidth + 1; // new
} else {
    if(yBar) //new
        yoff = plotHeight + 1; //new
}

當tickBar設置為false時,偏移量保持為0,因此該線的寬度/高度值被繪制為0,因此看不到它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM