Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1 error chart #433

Open
tomwayson opened this issue Jun 21, 2018 · 3 comments
Open

v1 error chart #433

tomwayson opened this issue Jun 21, 2018 · 3 comments

Comments

@tomwayson
Copy link
Member

@rgdonohue asked in slack about how you can adapt the v0 error bars example to work in v1. Here's a working example:

Go to http://cedar-v1.surge.sh/ and enter the following in the JSON editor:

{
  "type": "bar",
  "datasets": [
    {
      "data": {
        "features": [
          {"attributes": {"state": "CA", "pop": 5000, "error": 2000}},
          {"attributes": {"state": "AZ", "pop": 2000, "error": 1400}},
          {"attributes": {"state": "NY", "pop": 8000, "error": 1000}}
        ]
      }
    }
  ],
  "series": [
    {
      "category": {"field": "state", "label": "State"},
      "value": {"field": "pop", "label": "Population"}
    }
  ],
  "overrides": {
    "valueAxes": [{
      "id": "v1"
    }],
    "graphs": [{
      "balloonText": "value:<b>[[value]]</b><br>error:<b>[[error]]</b>",
      "bullet": "yError",
      "bulletSize": 10,
      "errorField": "error",
      "bulletAxis": "v1"
    }]
  }
}

You will get something like this:

image

The key is the overrides section which allows you to set the relevant AmCharts properties to match their error char example.

@benstoltz

If we want to make this easier we should add default ids to the spec axes.

@ajturner @ghudgins

Do we want to open an issue for the Cedar JSON to support errors, perhaps by allowing users to specify an errorField on series, so that consumers don't have to use overrides?

@rgdonohue
Copy link

rgdonohue commented Jun 22, 2018

@tomwayson A need is often to do more than draw these bars for a single error value but to draw them according to upper and lower confidence interval values, which won't be symmetrical for non-normalized distributions.

@tomwayson
Copy link
Member Author

That makes sense. I did a quick check and did not see a way to do it in amCharts. If it can be done in amCharts, it can be done in cedar v1.

@rgdonohue
Copy link

There's a "bulletOffset" option for the graphs. Seems like we should be able to deduct the difference between the UCI and value from the LCI and value, and then offset the bullet with that number. Not currently working for me though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants