Skip to content

Refactor annotations to be another type of datum. #358

Description

@mauriciopoppe

The current API looks like this:

functionPlot({
  target: '#tip',
  annotations: [
    {
      x: -1
    },
    {
      x: 1,
      text: 'x = 1'
    },
    {
      y: 2,
      text: 'y = 2'
    }
  ]
  data: [
    { fn: 'x^2' },
  ]
})

Ideas for API

Move the annotation to be another type of datum.

functionPlot({
  target: '#tip',
  yDomain: [-1, 9],
  data: [
    { fn: 'x^2' },
    { fn: 'x', skipTip: true },
    functionPlot.Annotation({ x: -1 }),
    functionPlot.Annotation({ y: 2, text: 'y = 2' }),
  ]
})

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions