簡體   English   中英

使條形圖與條形圖一起使用

[英]Getting Flot Chart to work with bar graph

我在獲取顯示任何數據的欄時遇到麻煩。 數據在餅圖中工作正常,但在條形圖中未顯示任何數據。 我不知道為什么,但希望你們中的一個可以。 這是我正在使用的數據。

數據

Object, Object, Object]
0: Object
  color: "#0150AC"
  data: "8.00"
  label: "Please rate the location of our property."
  ticks: "Please rate the location of our property."
  __proto__: Object
1: Object
  color: "#DE6E26"
  data: "8.00"
  label: "Please rate the friendliness and courtesy of our staff."
  ticks: "Please rate the friendliness and courtesy of our staff."
  __proto__: Object
2: Object
  color: "#559B1E"
  data: "1.60"
  label: "Please rate the cleanliness of your room upon check-in."
  ticks: "Please rate the cleanliness of your room upon check-in."
 __proto__: Object
length: 3
__proto__: Array[0]

選件

bars: Object
  show: true
__proto__: Object
_proto__: Object

持票人

selector: "#prime_bar_chart"

呼叫方法

function buildGraph(placeholder, data, options) {
    $.plot(placeholder, data, {

    series: options,

    legend: {
        show: true,
        backgroundColor:'#E1DFE0',
        margin:[-55, 0]
}});

}

@Sergio是正確的。 折線圖和條形圖需要以下格式的數據

[ [x1, y1], [x2, y2], ... ]

餅圖略有不同,並且可以包含單個數據值。

這是一個帶有數據的小提琴演示

順便說一句, ticks不是系列對象的屬性,而是xaxis, yaxis (請參見此處)

暫無
暫無

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

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