Git Product home page Git Product logo

Comments (11)

GoogleCodeExporter avatar GoogleCodeExporter commented on May 6, 2024
I found:

in "TableDescriptionParser", when "depth = 1", tabledesc = "{'Col2', 'string}, 
the 
program still jump over line 381:
"if len(table_description) != 1:"
and goto line 401:
execute "table_description.values()[0]", which use 'string' as new tabledesc 
and 
start deeper(depth=2) parsing.

Is it correct?

Original comment by Feng.W.QIN on 15 Mar 2009 at 8:46

from google-visualization-python.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 6, 2024
I couldn't understand all codes of yours, and My suggestion is changing line 
381:

if len(table_description) != 1 or depth > 0:

Is it correct?

Original comment by Feng.W.QIN on 15 Mar 2009 at 8:53

from google-visualization-python.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 6, 2024
in gviz_api_test.py, I add following from line 174:

self.assertEqual(
        [{"id": "a", "label": "column a", "type": "number",
          "depth": 0, "container": "dict"},
         {"id": "b", "label": "b", "type": "number",
          "depth": 1, "container": "dict"}],
        DataTable.TableDescriptionParser({("a", "number", "column a"):
                                          {"b": "number"}}))

test reported error:
D:\Data\Documents\Workspace\google-visualization-python>gviz_api_test.py
............
----------------------------------------------------------------------
Ran 12 tests in 0.110s

OK

D:\Data\Documents\Workspace\google-visualization-python>gviz_api_test.py
.....F......
======================================================================
FAIL: testTableDescriptionParser (__main__.DataTableTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\Data\Documents\Workspace\google-visualization-python\gviz_api_test.py
", line 181, in testTableDescriptionParser
    {"b": "number"}}))
AssertionError: [{'container': 'dict', 'depth': 0, 'type': 'number', 'id': 'a',
'label': 'column a'}, {'container': 'dict', 'depth': 1, 'type': 'number', 'id':
'b', 'label': 'b'}] != [{'container': 'dict', 'depth': 0, 'type': 'number', 'id'
: 'a', 'label': 'column a'}, {'container': 'dict', 'depth': 1, 'type': 'string',
 'id': 'b', 'label': 'b'}, {'container': 'scalar', 'depth': 2, 'type': 'string',
 'id': 'number', 'label': 'number'}]

----------------------------------------------------------------------
Ran 12 tests in 0.031s

FAILED (failures=1)

Original comment by Feng.W.QIN on 15 Mar 2009 at 9:55

Attachments:

from google-visualization-python.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 6, 2024
The way you defined the columns is not supported by gviz_api.py.
The deepest level of the columns definition can't be a dictionary (and if it is,
gviz_api.py will consider it's key and value to be separate columns).
So what you actually defined here is a 3 column table with the columns "Col1", 
"Col2"
and "string".

We did it this way, because otherwise we might have an ambiguity between the two
cases, and it seems the second one (the one we used) might be more mindful. (The
alternative is having dictionaries of only one constant key).

Original comment by [email protected] on 16 Mar 2009 at 11:54

from google-visualization-python.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 6, 2024
That's fine, but I'm wanna to keep an unique data structure outside of filling 
a table function, which may query datastore 
and fill table dynamically, so dictionary is my choice. Like following:

    #Use default StatsDT class
    statsDT = self.getStatsDT(results)
    cols = dict()
    rows = dict()
    colOrder = list()
    statsDT.fill(cols, rows, colOrder, results, name, dims, datefmt) <-- this object may fill the table with only 2 columns

    data_table = gviz_api.DataTable(cols)
    data_table.AppendData(rows)
    self.response.out.write(data_table.ToJSonResponse(columns_order=colOrder,order_by=colOrder[0]))

How can I proceed this correctly per your opinion?


Original comment by Feng.W.QIN on 16 Mar 2009 at 12:02

from google-visualization-python.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 6, 2024
We did not fully understand you but let me know if this helps:

It's ok if you want your structure to be dictionaries, but not every structure 
of
dictionaries is supported (sometimes it's just impossible, because it creates 
ambiguity).
What you can do is structure your data as following:

columns = {'col1': 'col2'}
rows = {'row1, col1': row1, col2', 'row2, col1': 'row2, col2', ...}

This way, there's no ambiguity (each last level is a string, not a dictionary), 
but
you still can hold everything in dictionaries.

Original comment by [email protected] on 18 Mar 2009 at 3:00

from google-visualization-python.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 6, 2024
I don't understand your comments, where is the value I should put in?

My question is:
Sometimes I need use a function to fill cols and rows, which querys data from 
datastore. Thus I'm not sure when the query return only TWO cols, and I don't 
want to check if it has only TWO cols, and I need re-format the cols and rows 
to 
list structure or the dictionary structure in your comments.
I just want to an unique dictionary structure as params put into function.

is it possible?

Original comment by Feng.W.QIN on 18 Mar 2009 at 3:12

from google-visualization-python.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 6, 2024
I do not think what you want is possible.

The gviz_api.py assumes you pass it the same data as described in the 
description
given before.
We don't support giving other structures of data later on.
If you defined it has 2 columns, you should always give it 2 columns.

I don't know the specifics of your datastore and the query you give it, but you 
will
probably need to manipulate the data after it returns from the datastore (like 
you
said, check if it has only two cols. I don't understand why you don't want to 
do it).

Original comment by [email protected] on 23 Mar 2009 at 3:00

from google-visualization-python.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 6, 2024
I have a function, which generates data. Because it can't be expected columns 
of 
query results(2, or 3 or more...), I always use dictionary as input param to 
let the 
function to fill. And I don't want to check columns, because I think gviz_api 
could 
accept it, since  {('Col1', 'String'): {'Col2': 'string'}} is also a reasonable 
structure for 
me.

OK. If you don't want to change it, I could add a check by myself.

Original comment by Feng.W.QIN on 23 Mar 2009 at 3:11

from google-visualization-python.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 6, 2024
Unfortunately, at this point this is the API we provide, so you'll have to add 
the
check by yourself.

Original comment by [email protected] on 23 Mar 2009 at 3:47

from google-visualization-python.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 6, 2024

Original comment by misha.seltzer on 6 May 2009 at 9:34

  • Changed state: WontFix

from google-visualization-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.