ฉันมีแผนภูมิที่มี series หลายรายการถูกเพิ่มลงใน yAxis เมื่อใดก็ตามที่ฉันพยายามโทร .addPoint
ไปยังสิ่งอื่นนอกเหนือจาก yAxis แรก รันไทม์ JS ของแท็บเบราว์เซอร์นั้นจะหยุดทำงาน
ถ้าฉันเพิ่มอนุกรมของฉันไปที่ yAxis แรก คะแนนจะถูกเพิ่มลงในกราฟได้สำเร็จ ด้านล่างประมาณรหัสของฉัน (ใน Clojurescript) มีอะไรที่ชัดเจนที่ฉันต้องทำเพื่ออำนวยความสะดวกในการวาดไปยังหลาย yAxis หรือไม่?
;; CHART SETUP
(def yaxis-config [{:title {:text "Y Axis: A"}
:height 200}
{:title {:text "Y Axis: B"}
:height 100
:top 300}])
(def series-config [{:name "Series A"
:id "series-a"
:yAxis 0
:data []
:tooltip {"valueDecimals" 2}}
{:name "Series B"
:id "series-b"
:yAxis 0
:data []
:tooltip {"valueDecimals" 2}}
{:name "Series C"
:id "series-c"
:type "arearange"
:lineWidth 0
:fillOpacity 0.3
:zIndex 0
:yAxis 0
:data []
:tooltip {"valueDecimals" 2}}
{:name "Series D"
:id "series-d"
:yAxis 1 ;; ** Only difference I notice
:data []
:shadow true
:tooltip {:valueDecimals 2}}])
(let [chart-options (clj->js {:title {:text "My Title"}
:yAxis yaxis-config
:series series-config})]
(.stockChart js/Highcharts "container" chart-options))
;; ADD A POINT
(let [charts (aget (.-charts js/Highcharts) 0)
series-a (aget (.-series charts) 0)
series-b (aget (.-series charts) 1)
series-c (aget (.-series charts) 2)
series-d (aget (.-series charts) 3)
data-a [1234567 112.5]
data-b [1234567 123.11]
data-c [1234567 155.7]
data-d [1234567 0.257]]
(.addPoint series-a (js/eval (clj->js data-a)) true false)
(.addPoint series-b (js/eval (clj->js data-b)) true false)
(.addPoint series-c (js/eval (clj->js data-c)) true false)
;; ** If I don't make this call, points are successfully added.
;; When adding this call, the JS runtime freezes and redraw stops.
(.addPoint series-d (js/eval (clj->js data-d)) true false))