Page 1 of 1

Editable plot width

Posted: Tue Oct 09, 2018 4:04 am
by max
Hi again,

is it possible to modify the width of a plot using a TextBox?

I have defined a text box in name.u.yaml:

Code: Select all

- type: TextBox
            name: PlotWidth
            format: number
            inputPattern: '[0-9]+'
In the name.r.yaml I added:

Code: Select all

- name: plot
      title:  Plot
      type: Image
      width:  (PlotWidth)
      height: 400
      renderFun: .plot
This results in the following error:

Code: Select all

Unable to compile 'rulr.r.yaml':
	results.items[1].width is not of a type(s) integer
I guess the "width" is saved as a string in the text box. Is there an easy way to change this?

Thanks in advance!

Re: Editable plot width

Posted: Tue Oct 09, 2018 5:29 am
by jonathon
the .a.yaml file is key here. the option 'PlotWidth' needs to be of type 'Integer'

if you get stuck, commit it to github and we'll take a look.

jonathon

Re: Editable plot width

Posted: Tue Oct 09, 2018 5:51 am
by max
I defined the Width as an integer, but the error remains.

- name: PlotWidth
title: Width
type: Integer
default: 800

Re: Editable plot width

Posted: Tue Oct 09, 2018 6:01 am
by jonathon
ah, i think that a plot width doesn't allow data binding, so you'll have to do it manually.

add a `.init()` function beside your `.run()` method, and in that add something like:

self$results$plot$setSize(self$options$width, self$options$height)

cheers

jonathon

Re: Editable plot width

Posted: Tue Oct 09, 2018 8:01 am
by max
Works like a charm!
Cheers
Max