-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Functional statistics and charts (#3205)
- Loading branch information
Showing
31 changed files
with
868 additions
and
783 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
.meteredTicksArea { | ||
margin-left: 96px; | ||
margin-bottom: 6px; | ||
width: 100%; | ||
float: left; | ||
} | ||
.meteredTicks { | ||
float: left; | ||
height: 13px; | ||
width: 3px; | ||
margin-right: 2px; | ||
border-radius: 5px; | ||
} | ||
.meteredTicks.blueTick { | ||
background-color: var(--input-color); | ||
} | ||
.meteredTicks.blackTick { | ||
background-color: var(--input-color-default); | ||
} | ||
.meteredChartLegend { | ||
margin-left: 109px; | ||
margin-right: 13px; | ||
} | ||
.legendLabel { | ||
font-size: 13px; | ||
line-height: 19px; | ||
color: var(--stroke-color-hovered); | ||
} | ||
.legendValue { | ||
font-size: 13px; | ||
line-height: 19px; | ||
font-weight: 600; | ||
color: var(--input-color-default); | ||
} | ||
.blueLegend { | ||
float: left; | ||
} | ||
.blueLegend .legendLabel { | ||
margin-right: 10px; | ||
text-align: right; | ||
width: 104px; | ||
float: left; | ||
} | ||
.blueLegend .legendValue { | ||
float: right; | ||
} | ||
.blackLegend { | ||
float: right; | ||
} | ||
.blackLegend .legendLabel { | ||
text-align: left; | ||
float: right; | ||
width: 96px; | ||
} | ||
.blackLegend .legendValue { | ||
margin-right: 10px; | ||
float: left; | ||
} | ||
|
||
.circleTooltip { | ||
width: 6px; | ||
height: 6px; | ||
border-radius: 50%; | ||
margin: 6px; | ||
} | ||
.rowLegend { | ||
padding-bottom: 10px; | ||
} | ||
.chartTooltip { | ||
background-color: var(--background-container); | ||
padding: 10px; | ||
border-radius: 10px; | ||
} | ||
.chartTooltipValue { | ||
display: inline-block; | ||
margin-left: 0.2em; | ||
} | ||
.tooltipLine { | ||
display: flex; | ||
flex-direction: row; | ||
} | ||
.xAxis, | ||
.yAxis text { | ||
fill: var(--chart-axis-text); | ||
} | ||
.xAxis, | ||
.yAxis line { | ||
stroke: var(--chart-axis-stroke); | ||
} | ||
.recharts-tooltip-cursor { | ||
fill: var(--chart-cursor-color); | ||
} | ||
@media screen and (max-width: 1179px) { | ||
.meteredTicksArea { | ||
margin-left: 60px; | ||
} | ||
} | ||
@media screen and (max-width: 768px) { | ||
.meteredChartLegend { | ||
margin: 0; | ||
} | ||
.meteredTicksArea { | ||
margin-left: 0; | ||
} | ||
.blueLegend .legendLabel { | ||
width: initial; | ||
} | ||
.blackLegend .legendLabel { | ||
width: initial; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { classNames } from "pi-ui"; | ||
import styles from "./Charts.module.css"; | ||
import { useChart } from "./hooks"; | ||
|
||
const MeteredChart = ({ | ||
additive, | ||
blueLabel, | ||
blueValue, | ||
blackLabel, | ||
blackValue | ||
}) => { | ||
const { sidebarOnBottom } = useChart(); | ||
const ticksCount = sidebarOnBottom ? 62 : 100; | ||
const createTicks = (additive, blueValue, blackValue) => { | ||
const ticks = []; | ||
let blueTicks; | ||
let blackTicks; | ||
if (additive) { | ||
blueTicks = (blueValue / (blueValue + blackValue)) * ticksCount; | ||
blackTicks = ticksCount - blueTicks; | ||
} else { | ||
blueTicks = blueValue; | ||
blackTicks = blackValue; | ||
} | ||
for (let i = 0; i < blueTicks; i++) { | ||
ticks.push( | ||
<div | ||
key={"blue-ticks-" + i} | ||
className={classNames(styles.meteredTicks, styles.blueTick)} | ||
/> | ||
); | ||
} | ||
for (let j = 0; j < blackTicks; j++) { | ||
ticks.push( | ||
<div | ||
key={"black-ticks-" + j} | ||
className={classNames(styles.meteredTicks, styles.blackTick)} | ||
/> | ||
); | ||
} | ||
return ticks; | ||
}; | ||
|
||
return ( | ||
<> | ||
<div className={styles.meteredTicksArea}> | ||
{createTicks(additive, blueValue, blackValue)} | ||
</div> | ||
<div className={styles.meteredChartLegend}> | ||
<div className={styles.blueLegend}> | ||
<div className={styles.legendLabel}>{blueLabel}</div> | ||
<div className={styles.legendValue}>{blueValue}</div> | ||
</div> | ||
<div className={styles.blackLegend}> | ||
<div className={styles.legendValue}>{blackValue}</div> | ||
<div className={styles.legendLabel}>{blackLabel}</div> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default MeteredChart; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.