Hello, could someone help me with changing colors of histogram's DataSeries? I've following code:
(let [plot (histogram (sample-normal 20))
_ (add-histogram plot (sample-normal 20))
render (-> plot .getPlot .getRenderer)]
(.setSeriesOutlinePaint render 1 java.awt.Color/BLUE)
(.setSeriesFillPaint render 1 java.awt.Color/BLUE)
(view plot))
and while it changes outline color correctly, the fill paint remains unchanged. šwhat happens when you use .setSeriesPaint
like set-stroke-color
does? https://github.com/incanter/incanter/blob/3f8ef1e24ee31b4cfa27a191eec95c3486afa81d/modules/incanter-charts/src/incanter/charts.clj#L3616 @arathunku
Nothing changes. I've read that add-histogram returns new chart so I tried it with the following code
(let [base-plot (histogram (sample-normal 20))
plot (add-histogram base-plot (sample-normal 20))
render (-> plot .getPlot (.getRenderer 0))]
(.setSeriesOutlinePaint render 1 Color/BLUE)
(.setSeriesPaint render 1 Color/BLUE)
(view plot))
@arathunku: Perhaps try .setBaseFillPaint
But Iām not confident in that
It changes color of all histograms on the chart
Oh, but you want the second series
Yeah
I've fighting with this for few hours and can't get this working so I'm writing a wrapper around http://xeiam.com/xchart-example-code/ Simpler API, enough for my needs and clojure wrapper might be useful for community in the future.
@arathunku: did you try .setPaint
already?
@nblumoe: same case as in .setBaseFillPaint
-> all data series change color š
ah, oh yeah. sorry, of course
well, tbh I don't ever use the jfreechart stuff. I ran into similar issues in the past š
you think you might want to try is using bar-chart
directly though
otherwise let me know how it goes with the xchart wrapper and don't forget dropping a link to the repo over here :simple_smile:
if you find time to open an issue on github, that would be great, too. I will look a bit more into this once I find the time myself
@nblumoe: I'll definitely post a link to a xchart wrapper if everything will work for me without a problem. I'll open an issue on github later (I want to try some other charts before giving up on it), no problem š
jfreechart is pathetic..
I'm open to alternatives, I've not found anything other than incanter for charts:/