hypirion / clj-xchart

XChart wrapper for Clojure
https://hypirion.github.io/clj-xchart/
Eclipse Public License 1.0
112 stars 6 forks source link

Java Float Array causes error #17

Open rosejn opened 2 years ago

rosejn commented 2 years ago

Hi, thanks for this library! Ran into an issue passing a Java float array as data to an xy chart (the only kind of chart I've used so far, so I'm not sure about others). If I turn it into a vector everything works fine, but it seems like any seq should work so I wanted to report it as an issue. In my case I'm getting this from a data layer which is querying a time-series database and returning float arrays. The relevant bits of stack trace are below, and here is the code I'm using to create a chart given some :block/data (the float array):

(let [ys (:block/data block)
      xs (range (count ys))
      chart (c/xy-chart {"pressure" {:x xs
                                                     :y ys
                                                     :style {:render-style :line
                                                                :marker-type :none}}})]
                      (c/view chart))
                     clojure.core/eval           core.clj: 3202
                                   ...
                 user$eval84353.invoke     NO_SOURCE_FILE:    1
           user$eval84353.invokeStatic     NO_SOURCE_FILE:    1
            mxv.plot$plot_block.invoke     NO_SOURCE_FILE:    8
      mxv.plot$plot_block.invokeStatic     NO_SOURCE_FILE:   10
                                   ...
     mxv.shared.stream-cache/get-block  stream_cache.cljc:  489
     mxv.shared.stream-cache/get-block  stream_cache.cljc:  504
  mxv.plot$plot_block$fn__84350.invoke     NO_SOURCE_FILE:   15
      com.hypirion.clj-xchart/xy-chart     clj_xchart.clj:  382
      com.hypirion.clj-xchart/xy-chart     clj_xchart.clj:  391
   com.hypirion.clj-xchart/add-series!     clj_xchart.clj:  366
com.hypirion.clj-xchart/add-raw-series     clj_xchart.clj:  346
                                   ...
java.lang.IllegalArgumentException: No matching method addSeries found taking 3 args for class org.knowm.xchart.XYCh