123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- import Chart from "../../../src/chart/bar/ChartBar24/ChartBar24";
-
- import Title from "../../../src/chart/commonOptions/title";
- import Grid from "../../../src/chart/commonOptions/grid";
-
-
- let bar = new Chart(document.querySelector(".c1"), {});
- window.addEventListener("resize", function () {
- bar.resize()
- });
-
- const option = {
- color: ["#0054ff", "#cb703d"],
- bg: {
- backgroundColor: '#0b0c0e'
- },
- title: Title.option(''),
- grid: Grid.option,
- legend: {
- left: "18%",
- top: '6%',
- itemHeight: 12,
- itemWidth: 12,
- itemAngelR: 0,
- textStyle: {
- fontSize: 16,
- color: '#ffffff'
- }
- },
- tooltip: {
- titleColor: '#ffffff',
- bgStyle: {
- borderColor: 'rgba(255,255,255,0.1)',
- borderWidth: 2,
- backgroundColor: '#000000',
- }
- },
- xAxis: {
- type: "category",
- name: '年份',
- nameTextStyle: {
- fontSize: 12,
- color: '#ffffff',
- },
- namePosition: 'end',
- axisLine: {
- show: true,
- lineStyle: {
- color: 'rgba(255,255,255,0.1)',
- width: 2,
- type: 'solid'
- }
- },
- axisTick: {
- show: true,
- alignWithLabel: true,
- length: 2,
- lineStyle: {
- color: '#ffffff',
- }
- },
- splitLine: {
- show: false,
- },
- axisLabel: {
- show: true,
- textStyle: {
- fontSize:12,
- fontWeight:'normal',
- color: '#ffffff'
- }
- },
- highLightColor: 'rgba(255,255,255,0.5)',
- data: ['2014', '2015', '2016'],
- },
- yAxis: {
- type: 'value',
- nameTextStyle: {
- color: '#ffffff',
- fontSize: 14
- },
- axisLine: {
- show: true,
- lineStyle: {
- color: '#ffffff',
- width: 1,
- }
- },
- axisTick: {
- show: true,
- lineStyle: {
- color: '#ffffff',
- },
- length: 2,
- alignWithLabel: true
- },
- splitLine: {
- show: false
- },
- axisLabel: {
- textStyle: {
- color: '#ffffff'
- }
- },
- },
- shape: {
- barGap: '30%',
- barCategoryGap: '40%',
- width: "85%",
- },
- series: [
- {
- name: '类别一',
- data: [ 1450, 1150, 1350]
- }
- ]
-
- };
-
- // setTimeout(() => {
- // bar.setOption(option);
- // }, 2000);
|