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

[BUG] incorrect x-axis range(date) in stacked area plot #1277

Closed
xiaohan2012 opened this issue Apr 3, 2016 · 1 comment
Closed

[BUG] incorrect x-axis range(date) in stacked area plot #1277

xiaohan2012 opened this issue Apr 3, 2016 · 1 comment
Assignees
Milestone

Comments

@xiaohan2012
Copy link

Simply, I am counting the number of items against time intervals.

Code:

{
  "data": {
    "url": "https://www.cs.helsinki.fi/u/hxiao/event_html/data/ukraine/vega/data.json"
  },
  "mark": "area",
  "encoding": {
    "x": {
      "timeUnit": "yearmonthdayhours",
      "field": "datetime",
      "type": "temporal",
      "scale": {
        "nice": "hour"
      },
      "axis": {
        "axisWidth": 0,
        "format": "%m-%d %H:00",
        "labelAngle": 15
      }
    },
    "y": {
      "aggregate": "count",
      "field": "*"
    },
    "color": {
      "field": "series",
      "type": "nominal",
      "scale": {
        "range": "category20"
      }
    }
  },
  "config": {
    "cell": {
      "width": 800,
      "height": 400
    }
  }
}

The bug is on range of x-axis:

  • Actual: Feb 8 to Mar, 1.
  • Expected: Feb-27 to Mar-03(min and max of the datetime in all items)

Or the web app: https://www.cs.helsinki.fi/u/hxiao/event_html/vega.html

@kanitw kanitw modified the milestone: 1.x.x Patches & Minor Features Apr 4, 2016
@domoritz domoritz assigned bobocandys and unassigned light-and-salt Apr 4, 2016
@domoritz
Copy link
Member

domoritz commented Apr 4, 2016

The issue is that you need to use date (day of the month) instead of day (day of the week). It's very confusing and I will add documentation to https://vega.github.io/vega-lite/docs/timeunit.html

{
  "data": {
    "url": "https://dl.dropboxusercontent.com/u/12770094/data.json"
  },
  "mark": "area",
  "encoding": {
    "x": {
      "timeUnit": "yearmonthdatehours",
      "field": "datetime",
      "type": "temporal"
    },
    "y": {
      "aggregate": "count",
      "field": "*"
    },
    "color": {
      "field": "series",
      "type": "nominal"
    }
  }
}

screen shot 2016-04-04 at 11 43 53

I'll add the time units that vega-lite supports from https://github.com/vega/vega/wiki/Expressions#datetime-functions to our docs.

domoritz added a commit that referenced this issue Apr 4, 2016
@kanitw kanitw closed this as completed in 45cc274 Apr 4, 2016
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

5 participants