Skip to content

standardize event interface so every event is a d3 event #15

@jameslaneconkling

Description

@jameslaneconkling

react event handling:

const Line = props => {
  const {data, xScale, yScale, containerWidth, containerHeight} = props;
  const styles = extractStyles(props);
  const events = extractEvents(props);

  xScale.rangeRound([0, containerWidth]);
  yScale.rangeRound([containerHeight, 0]);

  const line = d3.line()
    .x(d => xScale(d[0]))
    .y(d => yScale(d[1]));

  return (
    <g>
      <path
        {...styles}
        {...events}
        d={line(data)}
      />
    </g>
  );
};

d3 event handling

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions