Fork me on GitHub
#cljfx
<
2020-09-29
>
jjttjj18:09:41

I have a XYChart with a line on it and i want to highlight the rightmost value of the line on the Y axis, how do I do something like this in FX? I realize this is probably kind of advanced and will require manually just drawing a shape on the screen. Any tips for doing stuff like that? If I have a shape, how do I "put it in the axis"? Here's what I'm looking to do:

jjttjj18:09:00

I know this might not be very cljfx specific, hope it's ok to post some more general javafx stuff here, otherwise I can delete

jjttjj18:09:34

Although, I am also specifically wondering how do do this in cljfx 🙂

vlaaad19:09:34

hmm, don't really know, the closest thing I have in mind is showing the number on a data point itself:

{:fx/type :line-chart
 :x-axis {:fx/type :number-axis}
 :y-axis {:fx/type :number-axis}
 :data [{:fx/type :xy-chart-series
         :data
         (let [data (->> 0
                         (iterate #(-> % (+ (rand)) (- 0.5)))
                         (take 50)
                         (map-indexed vector))]
           (concat
             (->> data
                  butlast
                  (map (fn [[i n]]
                         {:fx/type :xy-chart-data
                          :x-value i
                          :y-value n})))
             [(let [[i n] (last data)]
                {:fx/type :xy-chart-data
                 :node {:fx/type :label
                        :style {:-fx-font-size 10}
                        :text (format "%.2f" n)}
                 :x-value i
                 :y-value n})]))}]}

jjttjj19:09:18

cool, that should be good enough, thanks!!

bartuka23:09:25

hi, I am trying to produce an AOT compiled artifact from a project using cljfx and I read in the readme that I need to call javafx.application.Platform/exit after compiling the files

bartuka23:09:50

I am using leiningen and could not find a good way to do that

bartuka23:09:59

do you have any hints?