8000 Refactor tip implementation to be another type of datum · Issue #356 · mauriciopoppe/function-plot · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Refactor tip implementation to be another type of datum #356
Open
@mauriciopoppe

Description

@mauriciopoppe

The current API looks like this:

functionPlot({
  target: '#tip',
  tip: {
    xLine: true, // dashed line parallel to y = 0
    yLine: true, // dashed line parallel to x = 0
    renderer: function (x, y, index) {
      // the returning value will be shown in the tip
    }
  },
  yDomain: [-1, 9],
  data: [
    { fn: 'x^2' },
    {
      fn: 'x',
      skipTip: true
    }
  ]
})

It provides some options for configuration but a user can't bring it's own tip or make it more customizable, examples:

  • What if I want to show data for both polylines at the same time? Right now it's one or the other.
Image Image

Ideas for API

Move tip to be another type of datum.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0