Giter Site home page Giter Site logo

Handle ?_labels=on about datasette-vega HOT 4 CLOSED

simonw avatar simonw commented on May 18, 2024
Handle ?_labels=on

from datasette-vega.

Comments (4)

simonw avatar simonw commented on May 18, 2024

This fix fails if the first row of the returned data has any null values for anything that should have been expanded - e.g.:

{
  "rowid": 1,
  "TreeID": 141565,
  "qLegalStatus": {
    "value": 1,
    "label": "Permitted Site"
  },
  "qSpecies": {
    "value": 1,
    "label": "Myoporum laetum :: Myoporum"
  },
  "qAddress": "501X Baker St",
  "SiteOrder": 1,
  "qSiteInfo": {
    "value": 1,
    "label": "Sidewalk: Curb side : Cutout"
  },
  "PlantType": {
    "value": 1,
    "label": "Tree"
  },
  "qCaretaker": {
    "value": 1,
    "label": "Private"
  },
  "qCareAssistant": null,
  "PlantDate": "07/21/1988 12:00:00 AM",
  "DBH": 21,
  "PlotSize": "Width 0ft",
  "PermitNotes": "Permit Number 25401",
  "XCoord": 6000609,
  "YCoord": 2110829,
  "Latitude": 37.7759676911831,
  "Longitude": -122.441396661871,
  "Location": "(37.7759676911831, -122.441396661871)"
}

Because this first row has "qCareAssistant": null the code will not correctly identify that as a column which has a label, and hence attempting to graph against that column will fail.

from datasette-vega.

simonw avatar simonw commented on May 18, 2024

I can fix this by inspecting every row of the data rather than just looking at data[0]

from datasette-vega.

simonw avatar simonw commented on May 18, 2024

Here's a demo of a scatter graph against a correctly identified column:

https://datasette-vega-latest.datasette.io/?url=https%3A%2F%2Fsan-francisco.datasettes.com%2Fsf-trees-ebc2ad9%2FStreet_Tree_List.json%3F_labels%3Don#g.mark=circle&g.x_column=TreeID&g.x_type=ordinal&g.y_column=qCaretaker.label&g.y_type=ordinal

2018-06-27 at 8 12 am

And here's the same demo against the incorrectly identified qCareAssistant:

https://datasette-vega-latest.datasette.io/?url=https%3A%2F%2Fsan-francisco.datasettes.com%2Fsf-trees-ebc2ad9%2FStreet_Tree_List.json%3F_labels%3Don#g.mark=circle&g.x_column=TreeID&g.x_type=ordinal&g.y_column=qCareAssistant&g.y_type=ordinal

2018-06-27 at 8 12 am

from datasette-vega.

simonw avatar simonw commented on May 18, 2024

https://datasette-vega-latest.datasette.io/?url=https%3A%2F%2Fsan-francisco.datasettes.com%2Fsf-trees-ebc2ad9%2FStreet_Tree_List.json%3F_labels%3Don#g.mark=circle&g.x_column=TreeID&g.x_type=ordinal&g.y_column=qCareAssistant.label&g.y_type=ordinal now works:

2018-06-27 at 8 20 am

from datasette-vega.

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.