On Wednesday, August 19, 2015 at 6:05:14 PM UTC+2, Daniel LaLiberte wrote:
>
> Hi Alban,
>
> I'll forward your question to the folks who work on the ChartEditor, which 
> is more in the realm of Google Spreadsheets.  
>

Thanks. Could you point me to where that post ended up? I can't seem to 
find it.
 

> But one thing I can help with is that the chartEditor.getChartWrapper() 
> call creates a clone of the ChartWrapper each time you call it, which is a 
> bit surprising, and is probably causing the problem you are seeing.   Try 
> just calling it once and setting options and drawing from that one copy.
>

I've been experimenting a bit with that idea in mind, but it looks to me 
that without creating a clone of the ChartWrapper (by using 
getChartWrapper()) the chart does not update to reflect the changes made in 
the editor. Of course, that is to be expected if the editor works on a 
clone, but in that case I don't see any way to use the ChartEditor 
_without_ using the cloned object.

What's a bit unfortunate is that it appears that the ChartWrapper clone 
still references the original chart options object that it modified in the 
ChartEditor. That's understandable, but a bit of an annoyance for options 
that the ChartEditor cannot set, such as the width and height of the graph; 
it modifies those options to 600x371 for some reason, while our charts were 
originally 900x700.

I've been successful by also creating a clone of the options object and 
apply that to the clone of the ChartWrapper returned from 
ChartEditor::getChartWrapper(), overriding the options that the ChartEditor 
modified in the process.

Interestingly, the original options object that was modified by the 
ChartEditor contains a property 'useFirstColumnAsDomain' after editing. 
That seems like the property I need. Unfortunately, adding that property to 
my ChartWrapper options (on creation) does not seem to set that option in 
the ChartEditor...
 

> On Wed, Aug 19, 2015 at 10:55 AM, Alban Hertroys <[email protected] 
> <javascript:>> wrote:
>
>> We have a number of charts, all with continuous X-axes. Currently we're 
>> looking into making these charts editable using the ChartEditor class.
>> The editor works, but there are a few issues.
>>
>> First our most relevant concern: Our continuous x-axis is read from the 
>> first column of a DataTable. This results in incorrect output upon opening 
>> the ChartEditor, it handles the first data-column just the same as any 
>> other data-column: as a column of data-values to plot on the y-axis.
>>
>> To work around this, we have to check the option "Use 1st column as 
>> labels" each time that we open the chart editor. Is there a way to have 
>> that set by default?
>> I couldn't find anything in the API documentation pointing in that 
>> direction.
>>
>> Secondly, after editing and pressing OK, the charts resize to a much 
>> smaller size than what we started on.
>> I managed to work around that problem by storing the chart wrapper 
>> dimensions (width & height) in a variable and then re-applying those values 
>> again when handling the 'ok' event of the ChartEditor, with these lines:
>>     chartEditor.getChartWrapper().setOptions({width: 900, height: 700});
>>     chartEditor.getChartWrapper().draw();
>>
>> That doesn't look like that's how it's supposed to work. Am I missing 
>> something?
>>
>> Regards,
>>
>> Alban.
>>
>>
>
> -- 
> Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> 
>  - 978-394-1058
> [email protected] <javascript:>   5CC, Cambridge MA
> [email protected] <javascript:> 9 Juniper Ridge Road, Acton MA
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/4b57da0a-7371-408e-9d41-4631d0f5a1b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to