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

Separate fields and their format in options #21

Closed
light-and-salt opened this issue Mar 15, 2016 · 5 comments
Closed

Separate fields and their format in options #21

light-and-salt opened this issue Mar 15, 2016 · 5 comments
Assignees
Milestone

Comments

@light-and-salt
Copy link
Contributor

Currently, the complete structure of options look like this:

var options = {
  showFields: [{ // specify data fields to be shown in the tooltip
    field: ..., // field name in the dataset
    fieldTitle: ..., // (optional) field title the tooltip should display
    type: 'date' | 'number' | 'string',
    format: timeUnit | string specifier
  }],
  offset: { // x and y offset (in pixels) of the tooltip
    x: 10,
    y: 10
  },
  colorTheme: 'light' | 'dark' // specify a color theme the tooltip should use
}

For both Vega-Lite and Vega tooltips, if you want to specify the format of a field you have to put an object like {field:..., format: ...} into options.showFields[], and if you put in an object for one field you have to put in objects for all the other fields that you want to display in the tooltip (because the tooltip plugin right now assumes you only want to display the fields in the showFields array).

It's better to separate fields and their formats. If a user wants to specify a format, she specifies the format -- it doesn't affect the "which fields get displayed" decision.

var options = {
  showFields: ['field1', 'field2', 'field3'],
  fieldsConfig: {
    field1: {
      fieldTitle: ..., // (optional) field title the tooltip should display
      type: 'time' | 'number' | 'string',
      format: timeUnit | string specifier
    }
  },
  offset: { // x and y offset (in pixels) of the tooltip
    x: 10,
    y: 10
  },
  colorTheme: 'light' | 'dark' // specify a color theme the tooltip should use
}
@domoritz
Copy link
Member

@kanitw I suggested this because otherwise it's hard to distinguish between e.g. configuring the formatter and saying that a particular field should be displayed.

@kanitw
Copy link
Member

kanitw commented Mar 15, 2016

I don't know what you two mean "name the field". (Is this VL or VG?)

@domoritz
Copy link
Member

This mainly applies to vl but imaging in vg if you want to specify the format of one field but still display all fields in the tooltip.

@light-and-salt
Copy link
Contributor Author

Sorry for the confusion. I just updated my original comment. By "name the field" I mean putting a field in options.showField[]

@light-and-salt
Copy link
Contributor Author

Close as we discussed in #34: we will combine fields and fieldConfigs with an showAllFields: boolean option

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

3 participants