Get data point positions?
See original GitHub issueI am attempting to do some custom drawing to “label” the data points. In order to do this I need the x and y of each data point. How do I access this information?
var draw = Chart.controllers.line.prototype.draw;
Chart.controllers.line = Chart.controllers.line.extend({
draw: function() {
draw.call(this, arguments[0]);
var ctx = this.chart.chart.ctx;
var points = // how do I get the data points positions?
$.each (points, function (k, v)
{
ctx.beginPath();
ctx.moveTo(v.x, v.y);
ctx.lineWidth = 3;
ctx.strokeStyle = '#ff0000';
ctx.lineTo(0, v.y);
ctx.stroke();
});
}
});
Issue Analytics
- State:
- Created 7 years ago
- Reactions:7
- Comments:7 (4 by maintainers)
Top Results From Across the Web
How to find, highlight and label a data point in Excel scatter plot
The tutorial shows how to identify, highlight and label a specific data point in a scatter chart as well as how to define...
Read more >Plot X and Y Coordinates in Excel - EngineerExcel
If you have a scatter plot and you want to highlight the position of a particular data point on the x- and y-axes,...
Read more >How to Spot Data Point in Excel Scatter Chart
Select the already created scatter chart. · Go to Design –> Select Data. · In the Select Data Source dialogue box, Click Add....
Read more >Extract Values to Points (Spatial Analyst)—ArcGIS Pro
ArcGIS geoprocessing tool that extracts the cell values of a raster based on a set of point features.
Read more >Getting Points Object at Specific Position in Scatter Plot Graph
It is a type of plot or mathematical diagram using Cartesian coordinates to display values for typically two variables for a set of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can use the following code.
chart
is the chart you have created (replace withthis
if calling from inside chart). Replacen
with the dataset that you want and replacei
with the point that you want. Both are zero-based indexes.Here is an example Codepen. Hope it will be helpful.
https://codepen.io/shivabhusal/pen/YxNGQN?editors=0010