You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2020/03/18 09:51:21 UTC

[GitHub] [incubator-echarts] Pierre-Bartet opened a new issue #12296: Give TypedArray as input

Pierre-Bartet opened a new issue #12296: Give TypedArray as input
URL: https://github.com/apache/incubator-echarts/issues/12296
 
 
   In the documentation, it is written:
   
   > ECharts supports TypedArray, which occupies less memory than array and is more gabbage-collection-friendly. For big data visualization, it is suggested to use TypedArray to improve performance.
   
   Yet this fail:
   
   `dataset:{
               dimensions: [
                   {name: 'x', type: 'float'},
                   {name: 'y', type: 'float'}
               ],
               source: [
                   Float32Array.from([1, 2, 3, 4, 5]),
                   Float32Array.from([6, 7, 8, 9, 10])
               ]
           }`
   
   While interestingly this works:
   
   `dataset:{
               dimensions: [
                   {name: 'x', type: 'float'},
                   {name: 'y', type: 'float'}
               ],
               source: [
                   [1, 2, 3, 4, 5],
                   Float32Array.from([6, 7, 8, 9, 10])
               ]
           }`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [incubator-echarts] PMeira commented on issue #12296: Give TypedArray as input

Posted by GitBox <gi...@apache.org>.
PMeira commented on issue #12296:
URL: https://github.com/apache/incubator-echarts/issues/12296#issuecomment-743961624


   > Yet this fail (using either float32 or float64):
   > `dataset:{ dimensions: [ {name: 'x', type: 'float'}, {name: 'y', type: 'float'} ], source: [ Float32Array.from([1, 2, 3, 4, 5]), Float32Array.from([6, 7, 8, 9, 10]) ] }`
   
   This first version using two Float32Arrays doesn't work because the `sourceFormat` is detected as `SOURCE_FORMAT_OBJECT_ROWS`. Looking here (current master branch):
   
   https://github.com/apache/incubator-echarts/blob/f765b203791b2a452cb5418d55e97a076ce532dc/src/data/Source.ts#L308-L310
   
   The second version works since the check marks it as `SOURCE_FORMAT_ARRAY_ROWS`, which is what we want. 
   
   Just updating the check from
   ```typescript
               else if (isArray(item)) {
   ```
   to
   ```typescript
               else if (isArray(item) || isTypedArray(item)) {
   ```
   seems to be enough to make it work with typed arrays without extra conversions. I tested with line and bar series, no issues so far. I'll report back if I hit other issues.
   
   @pissang, in another ticket, similar usage but without `dataset`, you mentioned this wasn't in the plans (https://github.com/apache/incubator-echarts/issues/13335#issuecomment-700422830 in reply to @lukasberbuer). Would you consider this small change to enable us to use a `dataset` with a list of typed arrays?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org