Skip to content

Commit 018b8df

Browse files
committed
aog wip
1 parent 5d3bf18 commit 018b8df

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

src/data_visualization/aog_in_clojure_part1.clj

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4021,16 +4021,17 @@ iris
40214021
facet-points (layer->points facet-layer)
40224022
transform-result (apply-transform facet-layer facet-points)
40234023
subplot-idx (+ (* row-idx num-cols) col-idx 1)
4024-
xaxis-key (if (= subplot-idx 1) :xaxis (keyword (str "xaxis" subplot-idx)))
4025-
yaxis-key (if (= subplot-idx 1) :yaxis (keyword (str "yaxis" subplot-idx)))]
4024+
;; Plotly.js expects "x", "x2", "x3" not "xaxis", "xaxis2", "xaxis3"
4025+
xaxis-ref (if (= subplot-idx 1) "x" (str "x" subplot-idx))
4026+
yaxis-ref (if (= subplot-idx 1) "y" (str "y" subplot-idx))]
40264027
(case (:type transform-result)
40274028
:raw
40284029
{:type "scatter"
40294030
:mode "markers"
40304031
:x (mapv :x facet-points)
40314032
:y (mapv :y facet-points)
4032-
:xaxis (name xaxis-key)
4033-
:yaxis (name yaxis-key)
4033+
:xaxis xaxis-ref
4034+
:yaxis yaxis-ref
40344035
:marker {:color (:default-mark theme) :size 6}
40354036
:showlegend false}
40364037

@@ -4040,8 +4041,8 @@ iris
40404041
:x (mapv (fn [b] (/ (+ (:x-min b) (:x-max b)) 2)) bars)
40414042
:y (mapv :height bars)
40424043
:width (mapv (fn [b] (- (:x-max b) (:x-min b))) bars)
4043-
:xaxis (name xaxis-key)
4044-
:yaxis (name yaxis-key)
4044+
:xaxis xaxis-ref
4045+
:yaxis yaxis-ref
40454046
:marker {:color (:default-mark theme)
40464047
:line {:color (:grid theme) :width 1}}
40474048
:showlegend false})
@@ -4056,8 +4057,8 @@ iris
40564057
:x (mapv (fn [b] (/ (+ (:x-min b) (:x-max b)) 2)) bars)
40574058
:y (mapv :height bars)
40584059
:width (mapv (fn [b] (- (:x-max b) (:x-min b))) bars)
4059-
:xaxis (name xaxis-key)
4060-
:yaxis (name yaxis-key)
4060+
:xaxis xaxis-ref
4061+
:yaxis yaxis-ref
40614062
:marker {:color (:default-mark theme)
40624063
:line {:color (:grid theme) :width 1}}
40634064
:showlegend false})

0 commit comments

Comments
 (0)