How to use the @vx/mock-data.appleStock.length function in @vx/mock-data

To help you get started, we’ve selected a few @vx/mock-data examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hshoff / vx / packages / vx-demo / components / tiles / lineradial.js View on Github external
const close = d => d.close;

// scales
const xScale = scaleTime({
  range: [0, Math.PI * 2],
  domain: extent(appleStock, date),
});
const yScale = scaleLog({
  domain: extent(appleStock, close),
});

const angle = d => xScale(date(d));
const radius = d => yScale(close(d));

const firstPoint = appleStock[0];
const lastPoint = appleStock[appleStock.length - 1];

export default ({ width, height }) => {
  if (width < 10) return null;

  yScale.range([0, height / 2 - 20]);

  return (
    <svg height="{height}" width="{width}">
      <linearGradient id="line-gradient"></linearGradient>
      <rect rx="{14}" fill="{bg}" height="{height}" width="{width}"></rect>
      
        {yScale.ticks().map((tick, i) =&gt; {
          const y = yScale(tick);
          const opacity = 1 / (i + 1) - (1 / i) * 0.2;
          return (
            <g></g></svg>