Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to change the xAxis or yAxis name text color and font size? #10

Closed
amyhuangxbd opened this issue Jun 27, 2017 · 1 comment
Closed

Comments

@amyhuangxbd
Copy link

amyhuangxbd commented Jun 27, 2017

Here is my code:

<template>  
<div class="container">
    <ve-line :data="chartData" :colors="chartColors" :settings="chartSettings" tooltip-visible :legend-visible="legendVisible" :init-options="initOptions" ></ve-line>
  </div>
</template>
<script>
import VeLine from 'v-charts/lib/line'
module.exports = {
  props: ['headerModel'],
  data () {
    return {
    }
  },
  components: {
    VeLine
  },
  filters: {
  },
  async created () {
    this.chartData = {
      columns: ['日期', '销售量'],
      rows: [
        { '日期': '1月1日', '销售量': 0.123 },
        { '日期': '1月2日', '销售量': 0.1223 },
        { '日期': '1月3日', '销售量': 0.2123 },
        { '日期': '1月4日', '销售量': 0.4123 },
        { '日期': '1月5日', '销售量': 0.3123 },
        { '日期': '1月6日', '销售量': 0.7123 }
      ]
    }
    this.chartColors = ['#ff5959']
    this.chartSettings = {
      yAxisType: ['percent'],
      yAxisColor: '#dadada'
    }
    this.legendVisible = false
    this.initOptions = {
      yAxis: [
        {
          axisLine: {
            lineStyle: {
              color: '#f0f',
              width: 8
            }
          },
          nameTextStyle: {
            color: '#f0f',
            fontSize: 28
          }
        }
      ],
      xAxis: [
        {
          axisLine: {
            lineStyle: {
              color: '#f0f',
              width: 8
            }
          },
          nameTextStyle: {
            color: '#f0f',
            fontSize: 28
          }
        }
      ]
    }
  }
}
</script>

<style scoped lang="less">
</style>

I set the nameTextStyle's color and fontSize by initOptions, But it seems not work.

@xiguaxigua
Copy link
Contributor

@amyhuangxbd
the initOptions is the third parameter of echarts.init, and if you want to set TextStyle's color and fontSize, you need to use after-config prop to change options after V-Charts create options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants