react实现多种可拖动滑块图表效果代码
代码语言:html
所属分类:图表
代码描述:react实现多种可拖动滑块图表效果代码,包括柱状图声音、范围面积图、价格区间、体积调节、扇形百分比进度调节、仪表盘指针调节等。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body{
color: #424E82;
background: #e5e7eb;
padding: 24px 0px;
}
:root {
--thumb-size: 24px;
--thumb-color:transparent;
}
input[type="range"]{
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
width: 100%;
outline: none;
position: absolute;
margin: auto;
top: 0;
height: var(--thumb-size);
background-color: transparent;
pointer-events: none;
}
input[type="range"]::-webkit-slider-runnable-track{
-webkit-appearance: none;
height: var(--thumb-size);
}
input[type="range"]::-moz-range-track{
-moz-appearance: none;
height: var(--thumb-size);
}
input[type="range"]::-ms-track{
appearance: none;
height: var(--thumb-size);
}
input[type="range"]::-webkit-slider-thumb{
-webkit-appearance: none;
height:100px;
width: var(--thumb-size);
background-color: var(--thumb-color);
cursor: pointer;
pointer-events: auto;
}
input[type="range"]::-moz-range-thumb{
border: none;
outline: none;
-webkit-appearance: none;
height:100px;
width: var(--thumb-size);
cursor: pointer;
background-color: var(--thumb-color);
pointer-events: auto;
}
input[type="range"]::-ms-thumb{
border: none;
outline: none;
appearance: none;
height:100px;
width: var(--thumb-size);
cursor: pointer;
background-color: var(--thumb-color);
pointer-events: auto;
}
input[type="range"]:active::-webkit-slider-thumb{
background-color: none;
}
input[type="range"]:focus::-moz-range-thumb {
border: none;
outline: none;
}
input[type="range"]:active::-moz-range-thumb {
border: none;
outline: none;
}
.rt90{
transform: rotate(90deg);
}
</style>
</head>
<body >
<div id="root"></div>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/babel.7.18.13.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/tailwindcss.3.0.0.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/react.production.17.1.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/react-dom.production.17.1.js"></script>
<script type="text/babel">
const { useEffect, useRef, useState} = window.React;
const { render } = window.ReactDOM;
function App() {
return (
<>
<div className="max-w-7xl mx-auto flex flex-wrap items-center justify-center">
<DemoA />
<DemoB />
<DemoC />
</div>
<div className="max-w-7xl mx-auto flex flex-wrap items-center justify-center">
<DemoD />
<DemoE />
<DemoF />
</div>
</>
);
}
function Card({ title, children }) {
return (
<div className="p-.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0