| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469 |
- <template>
- <div class="box">
- <div class="speedOption">
- <!-- 仪表盘 -->
- <svg
- viewBox="0,0,560,570"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- style="
- position: absolute;
- width: 560px;
- height: 570px;
- z-index: 0;
- top: 0;
- left: 0;
- "
- >
- <g>
- <image :href="require('../assets/img/cs.png')" />
- </g>
- </svg>
- <chart
- :options="speedOption"
- :autoResize="true"
- class="chartstyle"
- ></chart>
- </div>
- <div class="pressureOption">
- <!-- 仪表盘 -->
- <svg
- viewBox="0,0,560,570"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- style="
- position: absolute;
- width: 560px;
- height: 570px;
- z-index: 0;
- top: 0;
- left: 0;
- "
- >
- <g>
- <image :href="require('../assets/img/css.png')" />
- </g>
- </svg>
- <chart
- :options="pressureOption"
- :autoResize="true"
- class="chartstyle"
- ></chart>
- </div>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- // 车速表 圆盘value+阴影axisLine-color
- speedOption: {
- series: [
- // 内圆盘
- {
- type: "pie",
- radius: ["0", "25%"],
- center: ["50%", "50%"],
- z: 2,
- tooltip: {
- show: false,
- },
- avoidLabelOverlap: false,
- label: {
- normal: {
- show: false,
- },
- emphasis: {
- show: false,
- },
- },
- labelLine: {
- normal: {
- show: false,
- },
- },
- data: [
- {
- value: 600,
- itemStyle: {
- normal: {
- color: "rgba(21,31,36,1)",
- },
- },
- label: {
- rich: {
- a: {
- color: "#fff",
- align: "center",
- fontSize: 50,
- padding: [0, 0, 0, 0],
- fontWeight: "bold",
- shadowColor: "#063c92",
- fontFamily: "LCD",
- },
- b: {
- color: "#fff",
- align: "center",
- fontSize: 30,
- fontWeight: "bold",
- fontFamily: "微软雅黑",
- },
- },
- formatter: function (params) {
- return (
- "{a|" + params.value + "}\n\n" + "{b|" + "km/h" + "}"
- );
- },
- position: "center",
- show: true,
- },
- labelLine: {
- show: false,
- },
- },
- ],
- },
- // 内部阴影
- {
- type: "gauge",
- radius: "81%",
- z: 2,
- center: ["50%", "50%"],
- tooltip: {
- show: false,
- },
- axisLine: {
- lineStyle: {
- color: [
- [
- 600 / 1500,
- {
- x: 1,
- y: 1,
- x2: 0,
- y2: 0,
- colorStops: [
- {
- offset: 1,
- color: "rgba(24,100,128,0.8)",
- },
- {
- offset: 0,
- color: "rgba(24,100,128,0.1)",
- },
- ],
- },
- ],
- ],
- width: 200,
- },
- },
- axisLabel: {
- show: false,
- },
- axisTick: {
- show: false,
- },
- splitLine: {
- show: false,
- },
- detail: {
- show: false,
- },
- pointer: {
- // 指针
- show: true,
- length: "70%",
- },
- itemStyle: {
- color: "#fff",
- },
- data: [6000],
- },
- // 上层刻度数阴影
- {
- type: "gauge",
- min: 0,
- max: 1500,
- splitNumber: 12,
- radius: "80%",
- z: 2,
- startAngle: 225,
- endAngle: -45,
- axisLine: {
- show: false,
- },
- axisLabel: {
- fontSize: 28,
- fontWeight: "bolder",
- color: "white",
- fontFamily: "LCD",
- rich: {
- a: {
- fontSize: 28,
- fontWeight: "bolder",
- color: "white",
- fontFamily: "LCD",
- textShadowColor: "#22e4fb",
- textShadowBlur: 15,
- },
- },
- formatter: function (value) {
- const d = "{a|" + value + "}";
- return d;
- },
- },
- axisTick: {
- // 坐标轴小标记
- show: false,
- },
- splitLine: {
- // 分隔线
- show: false,
- },
- detail: {
- show: false,
- },
- },
- ],
- },
- // 车压表
- pressureOption: {
- series: [
- // 内圆盘
- {
- type: "pie",
- radius: ["0", "25%"],
- center: ["50%", "50%"],
- z: 3,
- hoverAnimation: false,
- data: [
- {
- value: 2,
- itemStyle: {
- normal: {
- color: "rgba(21,31,36,1)",
- },
- },
- label: {
- rich: {
- a: {
- color: "#fff",
- align: "center",
- fontSize: 50,
- padding: [0, 0, 0, 0],
- fontWeight: "bold",
- shadowColor: "#063c92",
- fontFamily: "LCD",
- },
- b: {
- color: "#fff",
- align: "center",
- fontSize: 30,
- fontWeight: "bold",
- },
- },
- formatter: function (params) {
- return (
- "{a|" + params.value + "}\n\n" + "{b|" + "m/s²" + "}"
- );
- },
- position: "center",
- show: true,
- },
- labelLine: {
- show: false,
- },
- },
- ],
- },
- // 阴影
- {
- type: "gauge",
- radius: "81%",
- z: 2,
- min: 0,
- max: 2,
- startAngle: 90,
- endAngle: -45,
- clockwise: true,
- center: ["50%", "50%"],
- tooltip: {
- show: false,
- },
- axisLine: {
- lineStyle: {
- color: [
- [
- 2 / 2,
- {
- x: 1,
- y: 1,
- x2: 0,
- y2: 0,
- colorStops: [
- {
- offset: 1,
- color: "rgba(24,100,128,0.8)",
- },
- {
- offset: 0,
- color: "rgba(24,100,128,0.1)",
- },
- ],
- },
- ],
- ],
- width: 200,
- },
- },
- axisLabel: {
- show: false,
- },
- axisTick: {
- show: false,
- },
- splitLine: {
- show: false,
- },
- detail: {
- show: false,
- },
- pointer: {
- show: false,
- },
- data: [4],
- },
- // 指针
- {
- type: "gauge",
- radius: "81%",
- z: 2,
- min: 0,
- max: 4,
- center: ["50%", "50%"],
- tooltip: {
- show: false,
- },
- axisLine: {
- lineStyle: {
- color: [
- [
- 4 / 4,
- {
- x: 0,
- y: 0,
- x2: 0,
- y2: 0,
- colorStops: [
- {
- offset: 1,
- color: "rgba(24,100,128,0.8)",
- },
- {
- offset: 0,
- color: "rgba(24,100,128,0.1)",
- },
- ],
- },
- ],
- ],
- width: 200,
- },
- },
- axisLabel: {
- show: false,
- },
- axisTick: {
- show: false,
- },
- splitLine: {
- show: false,
- },
- detail: {
- show: false,
- },
- pointer: {
- // 指针
- show: true,
- length: "70%",
- },
- itemStyle: {
- color: "#fff",
- },
- data: [4],
- },
- // 刻度数
- {
- type: "gauge",
- min: 0,
- max: 2,
- splitNumber: 2,
- radius: "80%",
- z: 2,
- startAngle: 90,
- endAngle: -45,
- axisLine: {
- show: false,
- },
- axisLabel: {
- fontSize: 28,
- fontWeight: "bolder",
- color: "white",
- fontFamily: "LCD",
- rich: {
- a: {
- fontSize: 28,
- fontWeight: "bolder",
- color: "white",
- fontFamily: "LCD",
- textShadowColor: "#22e4fb",
- textShadowBlur: 15,
- },
- },
- formatter: function (value) {
- const d = "{a|" + value + "}";
- return d;
- },
- },
- axisTick: {
- // 坐标轴小标记
- show: false,
- },
- splitLine: {
- // 分隔线
- show: false,
- },
- detail: {
- show: false,
- },
- },
- ],
- },
- };
- },
- };
- </script>
- <style>
- @font-face {
- font-family: "LCD";
- src: url("../assets/font/LCD.ttf") format("truetype");
- font-weight: normal;
- font-style: normal;
- }
- </style>
- <style scoped>
- .box {
- display: flex;
- }
- .speedOption,
- .pressureOption {
- width: 560px;
- height: 570px;
- position: relative;
- }
- .chartstyle {
- width: 100%;
- height: 100%;
- }
- </style>
|