@@ -130,6 +130,27 @@ declare module Plottable {
130
130
function darkenColor ( color : string , factor : number , darkenAmount : number ) : string ;
131
131
function distanceSquared ( p1 : Point , p2 : Point ) : number ;
132
132
function isIE ( ) : boolean ;
133
+ /**
134
+ * Returns true if the supplied coordinates or Extents intersect or are contained by bbox.
135
+ *
136
+ * @param {number | Extent } xValOrExtent The x coordinate or Extent to test
137
+ * @param {number | Extent } yValOrExtent The y coordinate or Extent to test
138
+ * @param {SVGRect } bbox The bbox
139
+ * @param {number } tolerance Amount by which to expand bbox, in each dimension, before
140
+ * testing intersection
141
+ *
142
+ * @returns {boolean } True if the supplied coordinates or Extents intersect or are
143
+ * contained by bbox, false otherwise.
144
+ */
145
+ function intersectsBBox ( xValOrExtent : number | Extent , yValOrExtent : number | Extent , bbox : SVGRect , tolerance ?: number ) : boolean ;
146
+ /**
147
+ * Create an Extent from a number or an object with "min" and "max" defined.
148
+ *
149
+ * @param {any } input The object to parse
150
+ *
151
+ * @returns {Extent } The generated Extent
152
+ */
153
+ function parseExtent ( input : any ) : Extent ;
133
154
}
134
155
}
135
156
}
@@ -2682,13 +2703,13 @@ declare module Plottable {
2682
2703
*
2683
2704
* Here's a common use case:
2684
2705
* ```typescript
2685
- * plot.attr("r ", function(d) { return d.foo; });
2706
+ * plot.attr("x ", function(d) { return d.foo; }, xScale );
2686
2707
* ```
2687
- * This will set the radius of each datum `d` to be `d.foo`.
2708
+ * This will set the x accessor of each datum `d` to be `d.foo`,
2709
+ * scaled in accordance with `xScale`
2688
2710
*
2689
2711
* @param {string } attrToSet The attribute to set across each data
2690
- * point. Popular examples include "x", "y", "r". Scales that inherit from
2691
- * Plot define their meaning.
2712
+ * point. Popular examples include "x", "y".
2692
2713
*
2693
2714
* @param {Function|string|any } accessor Function to apply to each element
2694
2715
* of the dataSource. If a Function, use `accessor(d, i)`. If a string,
@@ -2801,31 +2822,15 @@ declare module Plottable {
2801
2822
getAllPlotData ( datasetKeys ?: string | string [ ] ) : PlotData ;
2802
2823
protected _getAllPlotData ( datasetKeys : string [ ] ) : PlotData ;
2803
2824
/**
2804
- * Retrieves the closest PlotData for the specified dataset(s)
2825
+ * Retrieves PlotData with the lowest distance, where distance is defined
2826
+ * to be the Euclidiean norm.
2805
2827
*
2806
- * @param {Point } queryPoint The point to query from
2807
- * @param {number } withinValue Will only return plot data that is of a distance below withinValue
2808
- * (default = Infinity)
2809
- * @param {string | string[] } datasetKeys The dataset(s) to retrieve the plot data from.
2810
- * (default = this.datasetOrder())
2811
- * @returns {PlotData } The retrieved PlotData.
2828
+ * @param {Point } queryPoint The point to which plot data should be compared
2829
+ *
2830
+ * @returns {PlotData } The PlotData closest to queryPoint
2812
2831
*/
2813
- getClosestPlotData ( queryPoint : Point , withinValue ?: number , datasetKeys ?: string | string [ ] ) : {
2814
- data : any [ ] ;
2815
- pixelPoints : {
2816
- x : number ;
2817
- y : number ;
2818
- } [ ] ;
2819
- selection : D3 . Selection ;
2820
- } ;
2821
- protected _getClosestPlotData ( queryPoint : Point , datasetKeys : string [ ] , withinValue ?: number ) : {
2822
- data : any [ ] ;
2823
- pixelPoints : {
2824
- x : number ;
2825
- y : number ;
2826
- } [ ] ;
2827
- selection : D3 . Selection ;
2828
- } ;
2832
+ getClosestPlotData ( queryPoint : Point ) : PlotData ;
2833
+ protected _isVisibleOnPlot ( datum : any , pixelPoint : Point , selection : D3 . Selection ) : boolean ;
2829
2834
}
2830
2835
}
2831
2836
}
@@ -2957,6 +2962,7 @@ declare module Plottable {
2957
2962
} ;
2958
2963
protected _generateDrawSteps ( ) : _Drawer . DrawStep [ ] ;
2959
2964
protected _getClosestStruckPoint ( p : Point , range : number ) : Interaction . HoverData ;
2965
+ protected _isVisibleOnPlot ( datum : any , pixelPoint : Point , selection : D3 . Selection ) : boolean ;
2960
2966
_hoverOverComponent ( p : Point ) : void ;
2961
2967
_hoverOutComponent ( p : Point ) : void ;
2962
2968
_doHover ( p : Point ) : Interaction . HoverData ;
@@ -3065,6 +3071,19 @@ declare module Plottable {
3065
3071
* @returns {Bar } The calling plot.
3066
3072
*/
3067
3073
barLabelFormatter ( formatter : Formatter ) : Bar < X , Y > ;
3074
+ /**
3075
+ * Retrieves the closest PlotData to queryPoint.
3076
+ *
3077
+ * Bars containing the queryPoint are considered closest. If queryPoint lies outside
3078
+ * of all bars, we return the closest in the dominant axis (x for horizontal
3079
+ * charts, y for vertical) and break ties using the secondary axis.
3080
+ *
3081
+ * @param {Point } queryPoint The point to which plot data should be compared
3082
+ *
3083
+ * @returns {PlotData } The PlotData closest to queryPoint
3084
+ */
3085
+ getClosestPlotData ( queryPoint : Point ) : PlotData ;
3086
+ protected _isVisibleOnPlot ( datum : any , pixelPoint : Point , selection : D3 . Selection ) : boolean ;
3068
3087
/**
3069
3088
* Gets the bar under the given pixel position (if [xValOrExtent]
3070
3089
* and [yValOrExtent] are {number}s), under a given line (if only one
@@ -3109,6 +3128,7 @@ declare module Plottable {
3109
3128
_hoverOverComponent ( p : Point ) : void ;
3110
3129
_hoverOutComponent ( p : Point ) : void ;
3111
3130
_doHover ( p : Point ) : Interaction . HoverData ;
3131
+ protected _getAllPlotData ( datasetKeys : string [ ] ) : PlotData ;
3112
3132
}
3113
3133
}
3114
3134
}
@@ -3135,14 +3155,6 @@ declare module Plottable {
3135
3155
[ attrToSet : string ] : ( datum : any , index : number , userMetadata : any , plotMetadata : PlotMetadata ) => any ;
3136
3156
} ;
3137
3157
protected _wholeDatumAttributes ( ) : string [ ] ;
3138
- protected _getClosestPlotData ( queryPoint : Point , datasetKeys : string [ ] , withinValue ?: number ) : {
3139
- data : any [ ] ;
3140
- pixelPoints : {
3141
- x : number ;
3142
- y : number ;
3143
- } [ ] ;
3144
- selection : D3 . Selection ;
3145
- } ;
3146
3158
protected _getClosestWithinRange ( p : Point , range : number ) : {
3147
3159
closestValue : any ;
3148
3160
closestPoint : {
@@ -3151,6 +3163,17 @@ declare module Plottable {
3151
3163
} ;
3152
3164
} ;
3153
3165
protected _getAllPlotData ( datasetKeys : string [ ] ) : PlotData ;
3166
+ /**
3167
+ * Retrieves the closest PlotData to queryPoint.
3168
+ *
3169
+ * Lines implement an x-dominant notion of distance; points closest in x are
3170
+ * tie-broken by y distance.
3171
+ *
3172
+ * @param {Point } queryPoint The point to which plot data should be compared
3173
+ *
3174
+ * @returns {PlotData } The PlotData closest to queryPoint
3175
+ */
3176
+ getClosestPlotData ( queryPoint : Point ) : PlotData ;
3154
3177
_hoverOverComponent ( p : Point ) : void ;
3155
3178
_hoverOutComponent ( p : Point ) : void ;
3156
3179
_doHover ( p : Point ) : Interaction . HoverData ;
0 commit comments