recharts#ReferenceDot JavaScript Examples
The following examples show how to use
recharts#ReferenceDot.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: miniSateSparkline.jsx From CovidIndiaStats with MIT License | 5 votes |
MiniStateSparkline = ({
requiredStateDailyData,
dataKey,
min,
max,
sparklineData,
stroke,
}) => {
return (
<section style={{ alignContent: "center" }}>
<ResponsiveContainer width="95%" height="100%" aspect={2.35}>
<LineChart
data={requiredStateDailyData.slice(
requiredStateDailyData.length - 20,
requiredStateDailyData.length
)}
syncId="line2"
>
<YAxis domain={[min, max]} hide={true} />
<Tooltip
content={<CustomTooltip />}
contentStyle={{
background: "rgba(255,255,255,0)",
border: "none",
textAlign: "left",
}}
active={true}
cursor={false}
position={{ x: -5, y: 0 }}
offset={5}
/>
<Line
type="monotone"
dataKey={dataKey}
stroke={stroke}
strokeWidth={2.2}
dot={false}
animationDuration={2000}
/>
<ReferenceDot
x={
sparklineData.slice(
sparklineData.length - 20,
sparklineData.length
).length - 1
}
y={Number(sparklineData.slice(-1))}
r={3}
fill={stroke}
stroke={stroke}
isAbove={true}
/>
</LineChart>
</ResponsiveContainer>
</section>
);
}
Example #2
Source File: miniSparkline.jsx From CovidIndiaStats with MIT License | 5 votes |
MiniSparkline = ({
sparklinedata,
min,
max,
type,
fill,
stroke,
datakey,
}) => {
const lineKey = ["confirmed", "active", "recovered", "deceased"];
return (
<ResponsiveContainer width="98%" height="100%" aspect={2.25}>
<LineChart data={sparklinedata} syncId="line2">
<YAxis domain={[min, max]} hide={true} />
<Tooltip
content={<CustomTooltip />}
contentStyle={{
background: "rgb(255,255,255)",
border: "none",
textAlign: "left",
}}
active={true}
cursor={false}
position={{ x: 0, y: 0 }}
offset={5}
/>
<Line
type="monotone"
dataKey={lineKey[datakey]}
stroke={fill}
strokeWidth={2}
dot={false}
animationDuration={2000}
/>
<ReferenceDot
x={type.length - 1}
y={Number(type.slice(-1))}
r={3.2}
fill={fill}
stroke={stroke}
isFront={true}
/>
</LineChart>
</ResponsiveContainer>
);
}
Example #3
Source File: miniStateSparkline.jsx From CovidIndiaStats with MIT License | 5 votes |
MiniStateSparkline = ({
requiredStateDailyData,
dataKey,
min,
max,
sparklineData,
stroke,
}) => {
return (
<section style={{ alignContent: "center" }}>
<ResponsiveContainer width="95%" height="100%" aspect={2.35}>
<LineChart
data={requiredStateDailyData.slice(
requiredStateDailyData.length - 20,
requiredStateDailyData.length
)}
syncId="line2"
>
<YAxis domain={[min, max]} hide={true} />
<Tooltip
content={<CustomTooltip />}
contentStyle={{
background: "rgba(255,255,255,0)",
border: "none",
textAlign: "left",
}}
active={true}
cursor={false}
position={{ x: -5, y: 0 }}
offset={5}
/>
<Line
type="monotone"
dataKey={dataKey}
stroke={stroke}
strokeWidth={2.2}
dot={false}
animationDuration={2000}
/>
<ReferenceDot
x={
sparklineData.slice(
sparklineData.length - 20,
sparklineData.length
).length - 1
}
y={Number(sparklineData.slice(-1))}
r={3}
fill={stroke}
stroke={stroke}
isAbove={true}
/>
</LineChart>
</ResponsiveContainer>
</section>
);
}