Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 1455 by
drew_gal...@abtassoc.com: Bug: annotations
broken/unsupported on DiffCharts
http://code.google.com/p/google-visualization-api-issues/issues/detail?id=1455
What steps will reproduce the problem? Please provide a link to a
demonstration page if at all possible, or attach code.
I suspect that annotations (and probably other column roles as well, though
I haven't explicitly tested for them) are simply not supported yet on
DiffCharts, but I'm filing this as a bug report in case they are supposed
to be working.
First off, in order to compute a diff on two data sources, both sources
must contain the same column types - including the same additional role
columns - even if one data set does not use the role(s). Ex:
var oldData = new google.visualization.DataTable({
cols: [
{type: 'string', label: 'Name'},
{type: 'number', label: 'Value'}
],
rows: [/*...*/]
});
var newData = new google.visualization.DataTable({
cols: [
{type: 'string', label: 'Name'},
{type: 'number', label: 'Value'},
{type: 'string', role: 'annotation'}
],
rows: [/*...*/]
});
var diffData = myChart.computeDiff(oldData, newData);
fails with the error: "Uncaught Error: Invalid column index 2. Should be an
integer in the range [0-1]." (see fiddle:
http://jsfiddle.net/asgallant/MsRj3/).
Adding in the annotation column to "oldData" gets past computing the diff
data, but gives a DataTable with this structure:
{
cols: [
{type: 'string', label: 'Name'},
{type: 'number', label: 'Value', role: 'old-data', p:
{role: 'old-data'}},
{type: 'number', label: 'Value', role: 'data', p: {role: 'data'}},
{type: 'string', role: 'old-data', p: {role: 'old-data'}},
{type: 'string', role: 'data', p: {role: 'data'}}
],
rows: [/*...*/]
}
Which then causes an error when drawing the chart: "All series on a given
axis must be of the same data type"; we should expect this given that
the "annotation" roles are not preserved (see fiddle:
http://jsfiddle.net/asgallant/MsRj3/2/). A DataView that reorders the
columns and give them proper roles should fix the problem:
var view = new google.visualization.DataView(diffData);
view.setColumns([0, 1, {
sourceColumn: 3,
role: 'annotation'
}, 2, {
sourceColumn: 4,
role: 'annotation'
}]);
but drawing the chart with the view then gives an odd error: "Invalid row
index <n>. Should be in the range [0-<n - 1>]." (where n is the number of
rows in the diffData DataTable; see fiddle:
http://jsfiddle.net/asgallant/MsRj3/3/).
The DiffCharts should support the full range of column roles supported by
the base chart for both the new and old data sets.
What component is this issue related to (PieChart, LineChart, DataTable,
Query, etc)?
DiffCharts
Are you using the test environment (version 1.1)?
(If you are not sure, answer NO)
What operating system and browser are you using?
Chrome, Windows 7 x64
*********************************************************
For developers viewing this issue: please click the 'star' icon to be
notified of future changes, and to let us know how many of you are
interested in seeing it resolved.
*********************************************************
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings