How to use the recharts/lib/util/ChartUtils.getValueByDataKey function in recharts

To help you get started, we’ve selected a few recharts 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 Vizzuality / gfw / app / javascript / components / charts / sankey-chart / sankey-component.js View on Github external
const getPayloadOfTooltip = (el, type, nameKey) => {
  const { payload } = el;
  if (type === 'node') {
    return [
      {
        payload: el,
        name: getValueByDataKey(payload, nameKey, ''),
        value: getValueByDataKey(payload, 'value')
      }
    ];
  }
  if (payload.source && payload.target) {
    const sourceName = getValueByDataKey(payload.source, nameKey, '');
    const targetName = getValueByDataKey(payload.target, nameKey, '');

    return [
      {
        payload: el,
        name: `${sourceName} - ${targetName}`,
        value: getValueByDataKey(payload, 'value')
      }
    ];
  }

  return [];
};
github Vizzuality / gfw / app / javascript / components / charts / sankey-chart / sankey-component.js View on Github external
const getPayloadOfTooltip = (el, type, nameKey) => {
  const { payload } = el;
  if (type === 'node') {
    return [
      {
        payload: el,
        name: getValueByDataKey(payload, nameKey, ''),
        value: getValueByDataKey(payload, 'value')
      }
    ];
  }
  if (payload.source && payload.target) {
    const sourceName = getValueByDataKey(payload.source, nameKey, '');
    const targetName = getValueByDataKey(payload.target, nameKey, '');

    return [
      {
        payload: el,
        name: `${sourceName} - ${targetName}`,
        value: getValueByDataKey(payload, 'value')
      }
    ];
  }
github Vizzuality / gfw / app / javascript / components / charts / sankey-chart / sankey-component.js View on Github external
const getPayloadOfTooltip = (el, type, nameKey) => {
  const { payload } = el;
  if (type === 'node') {
    return [
      {
        payload: el,
        name: getValueByDataKey(payload, nameKey, ''),
        value: getValueByDataKey(payload, 'value')
      }
    ];
  }
  if (payload.source && payload.target) {
    const sourceName = getValueByDataKey(payload.source, nameKey, '');
    const targetName = getValueByDataKey(payload.target, nameKey, '');

    return [
      {
        payload: el,
        name: `${sourceName} - ${targetName}`,
        value: getValueByDataKey(payload, 'value')
      }
    ];
  }

  return [];
};
github Vizzuality / gfw / app / javascript / components / charts / sankey-chart / sankey-component.js View on Github external
const getPayloadOfTooltip = (el, type, nameKey) => {
  const { payload } = el;
  if (type === 'node') {
    return [
      {
        payload: el,
        name: getValueByDataKey(payload, nameKey, ''),
        value: getValueByDataKey(payload, 'value')
      }
    ];
  }
  if (payload.source && payload.target) {
    const sourceName = getValueByDataKey(payload.source, nameKey, '');
    const targetName = getValueByDataKey(payload.target, nameKey, '');

    return [
      {
        payload: el,
        name: `${sourceName} - ${targetName}`,
        value: getValueByDataKey(payload, 'value')
      }
    ];
  }