mauriciopoppe / function-plot

A 2d function plotter for the web
https://mauriciopoppe.github.io/function-plot/
MIT License
926 stars 113 forks source link

How to display the coordinates of points #300

Closed qywk99 closed 4 months ago

qywk99 commented 4 months ago
functionPlot({
  target: '#points',
  data: [
    {
      points: [
        [1, 1],
        [2, 1],
        [2, 2],
        [1, 2],
        [1, 1]
      ],
      fnType: 'points',
      graphType: 'scatter'
    }
  ]
})

like desmos image

mauriciopoppe commented 4 months ago

You could do it with an additional item in the data array:

    {
      graphType: 'text',
      location: [1, 1],
      text: 'hello world'
    },

There's an example in the webpage https://mauriciopoppe.github.io/function-plot/#text