Values accessor

By default we assume that `items` has the shape `{key, value}`.

By providing a `valueAccessor` function we can derive the bar value from `items` with different shapes.

Usage

<BarchartVDiv
  {items}
  valueAccessor={item => Number((item.rawValue / 25.3).toFixed(3))}
/>

Props

items

    (49) [ {…} ,{…} ,{…} ,{…} ,{…} , ]
    • 0: { key: "AL" ,rawValue: 112 }
    • 1: { key: "AD" ,rawValue: 234 }
    • 2: { key: "AM" ,rawValue: 36 }
    • 3: { key: "AT" ,rawValue: 357 }
    • 4: { key: "AZ" ,rawValue: 123 }
    • 5: { key: "BY" ,rawValue: 56 }
    • 6: { key: "BE" ,rawValue: 15 }
    • 7: { key: "BA" ,rawValue: 12 }
    • 8: { key: "BG" ,rawValue: 568 }
    • 9: { key: "HR" ,rawValue: 213 }
    • 10: { key: "CY" ,rawValue: 456 }
    • 11: { key: "CZ" ,rawValue: 21 }
    • 12: { key: "DK" ,rawValue: 345 }
    • 13: { key: "EE" ,rawValue: 37 }
    • 14: { key: "FI" ,rawValue: 376 }
    • 15: { key: "FR" ,rawValue: 346 }
    • 16: { key: "GE" ,rawValue: 17 }
    • 17: { key: "DE" ,rawValue: 567 }
    • 18: { key: "GR" ,rawValue: 47 }
    • 19: { key: "HU" ,rawValue: 23 }
    • 20: { key: "IS" ,rawValue: 578 }
    • 21: { key: "IE" ,rawValue: 24 }
    • 22: { key: "IT" ,rawValue: 6 }
    • 23: { key: "KZ" ,rawValue: 5 }
    • 24: { key: "LV" ,rawValue: 58 }
    • 25: { key: "LI" ,rawValue: 5 }
    • 26: { key: "LT" ,rawValue: 69 }
    • 27: { key: "LU" ,rawValue: 23 }
    • 28: { key: "MT" ,rawValue: 36 }
    • 29: { key: "MD" ,rawValue: 57 }
    • 30: { key: "MC" ,rawValue: 69 }
    • 31: { key: "ME" ,rawValue: 223 }
    • 32: { key: "NL" ,rawValue: 35 }
    • 33: { key: "MK" ,rawValue: 57 }
    • 34: { key: "NO" ,rawValue: 79 }
    • 35: { key: "PL" ,rawValue: 12 }
    • 36: { key: "PT" ,rawValue: 46 }
    • 37: { key: "RO" ,rawValue: 37 }
    • 38: { key: "RU" ,rawValue: 678 }
    • 39: { key: "SM" ,rawValue: 345 }
    • 40: { key: "RS" ,rawValue: 67 }
    • 41: { key: "SK" ,rawValue: 23 }
    • 42: { key: "SI" ,rawValue: 567 }
    • 43: { key: "ES" ,rawValue: 23 }
    • 44: { key: "SE" ,rawValue: 768 }
    • 45: { key: "CH" ,rawValue: 56 }
    • 46: { key: "TR" ,rawValue: 78 }
    • 47: { key: "UA" ,rawValue: 2 }
    • 48: { key: "GB" ,rawValue: 56 }
    • length: 49

valueAccessor

    ƒ item => Number(Math.sqrt(item.rawValue)
    • length: 1
    • name: "valueAccessor"
    • [[Function]]: item => Number(Math.sqrt(item.rawValue).toFixed(3))
    • [[Prototype]]: ƒ ()
A…10.583 A…15.297 A…6 A…18.894 A…11.091 B…7.483 B…3.873 B…3.464 B…23.833 H…14.595 C…21.354 C…4.583 D…18.574 E…6.083 F…19.391 F…18.601 G…4.123 D…23.812 G…6.856 H…4.796 I…24.042 I…4.899 I…2.449 K…2.236 L…7.616 L…2.236 L…8.307 L…4.796 M…6 M…7.55 M…8.307 M…14.933 N…5.916 M…7.55 N…8.888 P…3.464 P…6.782 R…6.083 R…26.038 S…18.574 R…8.185 S…4.796 S…23.812 E…4.796 S…27.713 C…7.483 T…8.832 U…1.414 G…7.483