Modify

Opened 10 years ago

Last modified 6 years ago

#11700 new enhancement

null values

Reported by: Jarosław Pękala <jaroslaw.pekala@…> Owned by:
Priority: normal Component: VisualizationPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description (last modified by Ryan J Ollos)

When data contains nulls like:

Sp_data Ideal Real
2013-06-22 00:00:00+02:00 39 39
2013-06-22 00:00:00+02:00 39
2013-06-23 00:00:00+02:00 36
2013-06-24 00:00:00+02:00 33 32

error is raised:

All series on a given axis must be of the same data type

when null value is replaced by exact value ex:

Sp_data Ideal Real
2013-06-22 00:00:00+02:00 39 39
2013-06-22 00:00:00+02:00 1 39
2013-06-23 00:00:00+02:00 36 1
2013-06-24 00:00:00+02:00 33 32

chart is ok

I added to [vis] in trac.ini:

options = interpolateNulls:true

but result is the same as without this line.

Attachments (0)

Change History (3)

comment:1 Changed 10 years ago by Ryan J Ollos

Description: modified (diff)

comment:2 Changed 10 years ago by Jarosław Pękala <jaroslaw.pekala@…>

Two causes:

  1. Column types is deduced from first row values. If some of numeric columns contain 'null', column is treated as string. If mix of series types (numeric & string) is sent to API, it will result in an All series on a given axis must be of the same data type error. Workaround: first row cannot have null in non-string column.
  2. Plugin does not correctly support null values. Consider example:
Col1 Col2 Col3
'2014-01-01' 10 10
'2014-01-02' null 9

function populate (viz.js) will initialize DataTable with Col1 (date), Col2 (numeric), Col3 (numeric). First row will be added properly. Second will be skipped because Col2 = null, which is deduced as string - see line:

if (isNaN(value)) {
   // not a number, assume a string
   value = raw;
   type = 'string';
} 

because of line:

if (type != data.getColumnType(j))
    goodrow = false;

row is marked as invalid

I used workaround by adding one condition:

// if first row, add the columns
            if (i==0)
                data.addColumn(type, columns[j]);
	    else if (raw == '')
	    {
		value = null;
		goodrow = true;
	    }
            else if (type != data.getColumnType(j))
                goodrow = false;

This is not the solution for the point 1 (types) but solves the second (null)

comment:3 Changed 6 years ago by Ryan J Ollos

Owner: Rob Guttman deleted

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.