Login  Register

Re: Change in plot API

Posted by John Minter on Jun 28, 2019; 11:12am
URL: http://imagej.273.s1.nabble.com/Change-in-plot-API-tp5022293p5022295.html

Thanks for the explanation. I’ll give it a go.

On Fri, Jun 28, 2019 at 5:37 AM Michael Schmid <[hidden email]>
wrote:

> Hi John,
>
> yes, I see, it's the example at
>    https://wsr.imagej.net/download/Examples/JavaScript/Graph_Types.js
>
> It says "Requires ImageJ 1.52h or later", but I could not find a
> Plot.setType in these versions. It's neither in the last 1.52h version
> that I found on github nor in the first 152g version, 1.52g5.
>
> There is a method
>    Plot.setStyle(int index, String style)
> where the 'style' String should be a comma-separated list of the primary
> and secondary color, the line width and the type.
> So you can replace Plot.setType(9, types[i]) with, e.g.
>    plot.setStyle(0, "red,#ffa0a0,2,"+types[i]);
>
> Here 0 is the index of the PlotObject, 0 for the first object added to
> the plot, 1 for the second (if there are several data sets, also things
> like labels and lines added with the various "add" objects count. The
> legend does not count because there can be only one legend).
> In the second argument, the primary color (line color) is red, the
> secondary color (fill color) is hex ffa0a0 (light red), the line width is
> 2.
> The type can be any of these:
> "Circle", "X", "Line", "Box", "Triangle", "+", "Dot", "Connected
> Circles", "Diamond", "Custom", "Filled", "Bar", "Separated Bars"
>
> There is also a macro example in Help>Examples>Plots>Plot Styles.
>
>
> Michael
> ________________________________________________________________
>
>
> On 28.06.19 00:17, John Minter wrote:
> > Wayne, I was watching the 2015 video (at LOCI) where you were
> demonstrating plot functions. I was especially interested in the
> Graph_Types.js example. I tried this both on ImageJ and Fiji (having
> imported the classes). Both gives an error:
> >
> > TypeError: plot.setType is not a function
> >
> > I assume the API changed since you wrote that script. It is a nice
> example. Is there a fix to make it work?
> >
> > Best regards,
> > John Minter
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html