Improvements to getClosestPlotData()
Pre-release
Pre-release
Good afternoon,
This release features more nuanced default behavior for getClosestPlotData().
Features
Improvements to getClosestPlotData()
We've simplified the API. It now accepts a query point only:
getClosestPlotData(queryPoint: Point): PlotData;and the notion of "closest" differs by plot type:
Scatter,Pie, andGridPlots retain the Euclidean normLineandAreaPlots implement an x-then-y strategy; points are first compared by x-value and, if multiple points have the same x-value, their y-value is used as a tiebreakerBarPlots implement a similar x-then-y strategy, with the addition that bars containing the query point are always returned. For horizontalBarPlots, the strategy is y-then-x.
This makes it easy to show plot data tooltips in a user-friendly way.
Try it out here: http://jsfiddle.net/38ehL9p6/1/
Bugfixes
- Plottable stops reading colors from CSS when a maximum of 256 colors is reached (#1834)
Typescript-only API-Breaking Changes
getClosestPlotData()no longer accepts the two (optional) parameterswithinValueanddatasetKeys.