incanter

arathunku 2015-08-06T15:17:13.000014Z

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. šŸ˜•

nblumoe 2015-08-06T16:56:09.000015Z

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

arathunku 2015-08-06T17:04:27.000018Z

Nothing changes. I've read that add-histogram returns new chart so I tried it with the following code

arathunku 2015-08-06T17:04:36.000019Z

(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))

2015-08-06T17:28:00.000021Z

@arathunku: Perhaps try .setBaseFillPaint

2015-08-06T17:28:39.000022Z

But Iā€™m not confident in that

arathunku 2015-08-06T17:29:58.000023Z

It changes color of all histograms on the chart

2015-08-06T17:29:59.000024Z

Oh, but you want the second series

2015-08-06T17:30:00.000025Z

Yeah

arathunku 2015-08-06T17:38:19.000026Z

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.

nblumoe 2015-08-06T17:40:57.000027Z

@arathunku: did you try .setPaint already?

arathunku 2015-08-06T17:47:05.000028Z

@nblumoe: same case as in .setBaseFillPaint -> all data series change color šŸ˜•

nblumoe 2015-08-06T18:00:04.000029Z

ah, oh yeah. sorry, of course

nblumoe 2015-08-06T18:00:38.000030Z

well, tbh I don't ever use the jfreechart stuff. I ran into similar issues in the past šŸ˜ž

nblumoe 2015-08-06T18:01:16.000031Z

you think you might want to try is using bar-chart directly though

nblumoe 2015-08-06T18:01:50.000032Z

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:

nblumoe 2015-08-06T18:05:12.000033Z

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 2015-08-06T18:05:15.000034Z

https://github.com/incanter/incanter/issues

arathunku 2015-08-06T18:16:51.000036Z

@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 šŸ˜‰

shriphani 2015-08-06T18:31:22.000038Z

jfreechart is pathetic..

arathunku 2015-08-06T18:33:38.000039Z

I'm open to alternatives, I've not found anything other than incanter for charts:/