Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to define a new theme? #13

Open
rqcy opened this issue Oct 28, 2016 · 2 comments
Open

how to define a new theme? #13

rqcy opened this issue Oct 28, 2016 · 2 comments

Comments

@rqcy
Copy link

rqcy commented Oct 28, 2016

Is it possible to define a new theme in Clojure and use it later with :theme keyword?

@hypirion
Copy link
Owner

Yes, but as of now it requires a lot of Java interop and a solid understanding of the XChart API itself. It's on my list of things to resolve for 1.0, but it's not something I will focus on immediately.

@lischenko
Copy link

lischenko commented Apr 6, 2018

For simple cases you can tweak one of the existing themes by overriding its methods. For example:

(def my-theme
  (proxy [org.knowm.xchart.style.GGPlot2Theme] []
    (getPlotBackgroundColor [] (Color.  1.0 1.0 1.0))
    (getSeriesColors []        (into-array [(Color. 1.0 0.0 0.0)]))))

And then you use that object as a value for the :theme key.

(c/category-chart
 {"Steps" {:x (range 10)
           :y (range 10)}}
 {:title "Ladder"
  :theme  my-theme})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants