import { StreamOrdinalFrame } from "semiotic" const frameProps = { /* --- Data --- */ data: [{ name: "New York", color: "#ac58e5", year: 2011, value: 17.9 }, { name: "Las Vegas", color: "#E0488B", year: 2011, value: 18.7 }, ... ], chartType: "point", /* --- Size --- */ size: [540,450], margin: { left: 40, top: 50, bottom: 75, right: 160 }, /* --- Layout --- */ connectorAccessor: (d12) => d12.name, /* --- Process --- */ oAccessor: "year", rAccessor: "value", rExtent: [0,], /* --- Customize --- */ pieceStyle: (d12) => ({ fill: d12.color, stroke: "white", strokeOpacity: 0.5 }), connectorStyle: (d12) => ({ stroke: d12.color, strokeWidth: 2, opacity: 0.5 }), title: "% of Adults Who Binge Drink", showAxes: true, foregroundGraphics: [ <g transform="translate(400, 73)" key="legend"> <text key={1} fill={"#ac58e5"}> New York </text> <text key={2} y={20} fill={"#E0488B"}> Las Vegas </text> <text key={3} y={40} fill={"#9fd0cb"}> San Diego </text> <text key={4} y={60} fill={"#e0d33a"}> Denver </text> <text key={5} y={80} fill={"#7566ff"}> Oakland </text> </g> ], /* --- Annotate --- */ tooltipContent: d => { const datum = d.data || d return ( <div style={{ padding: "4px 8px", fontSize: 13 }}> <strong>{datum.name}</strong> <div>{datum.year}: {Number(datum.value).toFixed(1)}%</div> </div> ) }, oLabel: true } export default () => { return <StreamOrdinalFrame {...frameProps} /> }