-
Notifications
You must be signed in to change notification settings - Fork 44
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
Consider if we can design this in a way that's useful for Vega too. #10
Comments
@ZeningQu Probably worth trying the current code with example vega visualization and see if it works well. If yes, we might want to revise our API to take |
As you can see formatting is quite important here as well. We should have formatters for objects, numbers, and dates. |
Agreed. |
Awesome! I also recommend coordinating with @jhoffswell to ensure the tooltip API is sufficiently expressive, if she wishes to reuse it for the vega-debugger. |
Here's a demo of the tooltip plugin working with Vega visualizations (Vega examples are at the second half of the page): Here's documentation on how to use the tooltip library: Please feel free to try the tooltip and comment from Vega's perspective, and please let me know if there's anything unclear in the docs! |
Very cool! |
#44) * Add team credit to README * Remove export * Add Vega arc example (with tooltip) * Add Vega choropleth example * Add Vega force network and heatmap examples. Fix #10 * Add vgTooltip module for tooltip functions I'm not sure if I used `module` correctly. From what I've read `module` is better than `namespace`. * Tidy up index.html * Use JS instead of TS. Fix #12 Because I don't know how to use TypeScript modules!?!? * Re-add vgTooltip to avoid polluting global namespace * Use datalib to auto-format time I'm not referring to Vega/VL spec yet. * Create different APIs for vl and vg * Add options to tooltip API * Enable select fields to display for tooltip. Fix #8 * Allow specifying time format in options * Let tooltip show object. Add fieldTitle. Fix #18 * Modify options structure. Add showFields array in options. To allow timeUnit and numberFormat in options too. * Read timeUnit, numberFormat from vlSpec * Remove numberFormat example * Add options back to examples * Use vl.timeUnit.format (locally) * Fix #6. Let `abbreviated` be the default (= false) in vl.timeUnit.format() * Rename fields related to timeUnit in options * Only show qualitative fields for line & area charts * Add warning in console for line and area charts * Add option to configure x and y offsets. Fix #11. * Add option to pick colorThemes. Fix #19. * Add layered bar chart example. Clean up examples. * Add trellis barley example * Use percentage to show unemployment rate for choropleth example * Split example page to multiple files * Reorder and add comment to three major library modules * Add comment to major utility functions * Add comment to various member functions * Create empty options object when options is not provided * Add options back to the examples * Add basic instructions to README * Add options description to README * Update README.md * Add syntax highlighting to code examples in README * Let all examples use npm installed local data * Simplify API to vlTooltip() and vgTooltip() * Change field display order for some examples * Remove space between function and ( * Use remote version of Vega-Lite Because vl.timeUnit.format() is now available remotely * Reorganize utility functions * Separate fields and formats * Rename opt.showFields to opt.fields Because I'm separating field titles and field value formats, so that they can be independently configured in options. In options we will have opt.fields, opt.titles, opt.valueFormats * Add option.titles option.titles is an array of {field: ..., title: ...} objects. We need the `field` key because we allow a field to be an object (e.g. `unemployment.id`) * Add tooltipData.name and tooltipData.title We need both name and title because we are passing tooltipData around multiple functions and we need an unique id for each field. * Add back options format * Combine title and value into fieldConfigs It's better to have the user write the fieldConfigs in one go, but have the system process titles and values separately (?) * Put rules from vlSpec in options.vlSpec * Add back timeUnit rules * Add back auto format * Add placeholders for "decide which fields to show logic" * Put APIs under vl and vg namespaces * Flatten function hierarchies - remove tooltipUtil scope * Flatten function hierarchies * Let fields be keys in options.fieldConfigs * Remove timeUnit as a format timeUnit should be supplemented from vlSpec; users should not need to provide it; specifying a different timeUnit than the axis may display erroneous data; the alternative (time string specifier) is good and users only have to learn one thing. * Use 'time' for formatType. Fix #25 * Combine fields and fieldConfigs. Add showAllFields in options. * Add custom field title * Format custom field values according to options * Clean up unused functions * Get title when showAllFields is true * Format value when showAllFields is true * Provide field name match User don't have to provide underscore prefixes any more. * Supplement formatType from vlSpec * Read user-specified format even when showAllFields is true * Supplement time and number formats. Fix #6 Supplement time format using fieldDef.timeUnit and vlSpec.config.timeFormat. Supplement number format using vlSpec.config.numberFormat. * Supplement options when showAllFields is false * Hide certain fields by default * Add back drop quan fields for line and area charts * Add multiple aggregation example * Update comments and examples for code review * Update README * Update options descriptions in README.md * Put options descriptions into a table * Simplify "Creating Your Tooltip" section in README Reduce the number of steps. Have bigger steps instead. * README: provide better descriptions for options * README: correct a typo * README: split into multiple files * Update comment for getCustomFields() and getAllFields() * Add binned examples * Combine rows for a binned field * Let binned fields have string formatType bin_field_start and bin_field_end are numbers. As we combine bin_field_start and bin_field_end into a single field, the field becomes a string (e.g. '10-20'). * Use data map instead of raw item.datum in getValue() Because we want to combine multiple bin fields in item.datum into a single field. This is a pre-processing action that should performed whether user wants to show custom fields or not. Hence I want to move the combineBinFields() function from getAllFields() to getTooltipData(). I will move other similar pre-processing functions to getTooltipData() too. This means both getAllFields() and getCustomFields() should take pre-processed data instead of raw data (item.datum). And this means the child functions in getCustomFields() should not take raw item.datum either. Hence I re-write getValue() to let it take a d3.map object instead. * Show correct bin range when showAllFields is false Because we move common pre-processing functions to getTooltipData() so it doesn't matter whether showAllFields is true or false -- we will get the clean data! * Clean up comments * Hide two bin examples from gallery * Clean up code and doc for review * Remove console.log() * Use _range instead of _start to store bin data
A comment from @arvind – at its simplest form, this plugin is useful for Vega too.
Maybe we can design make this more generic, while optionallly supporting some vega-lite specific features?
The text was updated successfully, but these errors were encountered: