diff --git a/docs/01-Chart-Configuration.md b/docs/01-Chart-Configuration.md index c12a102af9e..bf9eb5baa61 100644 --- a/docs/01-Chart-Configuration.md +++ b/docs/01-Chart-Configuration.md @@ -271,6 +271,7 @@ afterBody | `Array[tooltipItem], data` | Text to render after the body section beforeFooter | `Array[tooltipItem], data` | Text to render before the footer section footer | `Array[tooltipItem], data` | Text to render as the footer afterFooter | `Array[tooltipItem], data` | Text to render after the footer section +dataPoints | `Array[tooltipItem]` | List of matching point informations. #### Tooltip Item Interface @@ -288,7 +289,13 @@ The tooltip items passed to the tooltip callbacks implement the following interf datasetIndex: Number, // Index of this data item in the dataset - index: Number + index: Number, + + // X position of matching point + x: Number, + + // Y position of matching point + y: Number, } ``` diff --git a/docs/09-Advanced.md b/docs/09-Advanced.md index 5ea957179a6..1f5a1932a42 100644 --- a/docs/09-Advanced.md +++ b/docs/09-Advanced.md @@ -224,12 +224,12 @@ Scale instances are given the following properties during the fitting process. { left: Number, // left edge of the scale bounding box right: Number, // right edge of the bounding box' - top: Number, + top: Number, bottom: Number, width: Number, // the same as right - left height: Number, // the same as bottom - top - // Margin on each side. Like css, this is outside the bounding box. + // Margin on each side. Like css, this is outside the bounding box. margins: { left: Number, right: Number, @@ -246,7 +246,7 @@ Scale instances are given the following properties during the fitting process. ``` #### Scale Interface -To work with Chart.js, custom scale types must implement the following interface. +To work with Chart.js, custom scale types must implement the following interface. ```javascript { @@ -281,10 +281,10 @@ To work with Chart.js, custom scale types must implement the following interface Optionally, the following methods may also be overwritten, but an implementation is already provided by the `Chart.Scale` base class. ```javascript - // Transform the ticks array of the scale instance into strings. The default implementation simply calls this.options.ticks.callback(numericalTick, index, ticks); + // Transform the ticks array of the scale instance into strings. The default implementation simply calls this.options.ticks.callback(numericalTick, index, ticks); convertTicksToLabels: function() {}, - // Determine how much the labels will rotate by. The default implementation will only rotate labels if the scale is horizontal. + // Determine how much the labels will rotate by. The default implementation will only rotate labels if the scale is horizontal. calculateTickRotation: function() {}, // Fits the scale into the canvas. @@ -301,7 +301,7 @@ Optionally, the following methods may also be overwritten, but an implementation The Core.Scale base class also has some utility functions that you may find useful. ```javascript -{ +{ // Returns true if the scale instance is horizontal isHorizontal: function() {}, @@ -371,7 +371,7 @@ The following methods may optionally be overridden by derived dataset controller // chart types using a single scale linkScales: function() {}, - // Called by the main chart controller when an update is triggered. The default implementation handles the number of data points changing and creating elements appropriately. + // Called by the main chart controller when an update is triggered. The default implementation handles the number of data points changing and creating elements appropriately. buildOrUpdateElements: function() {} } ``` @@ -440,7 +440,7 @@ Plugins should derive from Chart.PluginBase and implement the following interfac ### Building Chart.js -Chart.js uses gulp to build the library into a single JavaScript file. +Chart.js uses gulp to build the library into a single JavaScript file. Firstly, we need to ensure development dependencies are installed. With node and npm installed, after cloning the Chart.js repo to a local directory, and navigating to that directory in the command line, we can run the following: diff --git a/samples/dataPoints-customTooltips.html b/samples/dataPoints-customTooltips.html new file mode 100644 index 00000000000..81441686e7a --- /dev/null +++ b/samples/dataPoints-customTooltips.html @@ -0,0 +1,104 @@ + + + +
+