This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-09-21
Channels
- # announcements (3)
- # architecture (5)
- # babashka (19)
- # beginners (145)
- # calva (1)
- # chlorine-clover (18)
- # cider (10)
- # clj-kondo (5)
- # cljsrn (3)
- # clojure (56)
- # clojure-berlin (19)
- # clojure-czech (2)
- # clojure-europe (32)
- # clojure-finland (2)
- # clojure-nl (3)
- # clojure-portugal (2)
- # clojure-spec (8)
- # clojure-uk (48)
- # clojurescript (48)
- # conjure (50)
- # cryogen (1)
- # cursive (28)
- # datomic (54)
- # depstar (12)
- # emacs (1)
- # events (8)
- # figwheel-main (6)
- # fulcro (4)
- # helix (4)
- # java (2)
- # jobs (2)
- # leiningen (1)
- # off-topic (29)
- # parinfer (4)
- # pathom (6)
- # portkey (3)
- # reagent (1)
- # remote-jobs (3)
- # reveal (16)
- # shadow-cljs (42)
- # sql (20)
- # tools-deps (11)
- # vim (4)
- # vrac (2)
hello, Im using the bar chart to try a chart with multiple series, my data looks like this:
{:impl-a {0 25.299999862909317,
7 19.39000003039837,
1 21.464999997988343,
4 20.795000018551946,
15 20.76500002294779,
13 21.65500004775822,
6 19.154999870806932,
17 20.804999861866236,
3 19.88500007428229,
12 23.38000014424324,
2 21.63999993354082,
19 23.924999870359898,
11 22.635000059381127,
9 25.545000098645687,
5 24.910000152885914,
14 19.585000118240714,
16 20.885000005364418,
10 20.819999976083636,
18 20.195000106468797,
8 19.580000080168247},
:impl-b {0 4.239999921992421,
7 17.385000130161643,
1 6.2200000975281,
4 9.77999996393919,
15 29.254999943077564,
13 25.88499989360571,
6 12.69999984651804,
17 38.07000000961125,
3 7.009999826550484,
12 24.105000076815486,
2 5.545000080019236,
19 41.569999884814024,
11 23.08499999344349,
9 24.960000067949295,
5 12.189999921247363,
14 29.519999865442514,
16 35.47999984584749,
10 20.249999826774,
18 40.43000005185604,
8 22.23999984562397}}
so when I plot it looks like this:
but in this chart, the order of the groups is important (I want it to go from 0 to 18, in order), is there any way to control the order of the series?
Hmm, sorted maps worked for me:
{:a (into (sorted-map) (map #(vector % (rand-int 100))) (range 10))
:b (into (sorted-map) (map #(vector % (rand-int 100))) (range 10))}
@vlaaad the problem to me is that I'm generating the data in CLJS and just copying over to a Reveal window (since I can't use cljs directly), and if I remember correctly, sorted-maps will sort based on values, not on keys, or I'm confusing things?
what you think about having some extra data to control the order? so it could be made explicit on the data itself
hmm, I think sorting chart series/keys makes sense anyway.. I'll think about that, thank you for input!
Also, if the order matters, wouldn't it make more sense to use lists with line chart instead of maps?
maybe, I didn't knew about this option, let me try 🙂
jinx 🙂