Code Monkey home page Code Monkey logo

Comments (8)

xiguaxigua avatar xiguaxigua commented on May 22, 2024 3

You're welcome! Every question you meet can be asked here.

from v-charts.

xiguaxigua avatar xiguaxigua commented on May 22, 2024

@Anehta What kind of scene do you need to use this or where you want to set this prop?

And I guess the following example may be helpful to you.🙂

<template>
  <div>
    <ve-line :data="chartData" :colors="chartColor"></ve-line>
  </div>
</template>
<script>
import VeLine from 'v-charts/lib/line'
import echarts from 'echarts/lib/echarts'
export default {
  data () {
    this.chartColor = [new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: '#5bcee2' }, { offset: 1, color: '#045d69' }])]
    return {
      chartData: {
        columns: ['日期', '余额', '比率'],
        rows: [
          { '日期': '1月1日', '余额': 123, '比率': 0.3 },
          { '日期': '1月2日', '余额': 1223, '比率': 0.6 }
        ]
      }
    }
  },
  components: { VeLine }
}
</script>

from v-charts.

xiguaxigua avatar xiguaxigua commented on May 22, 2024

Another example may be useful:

<template>
  <div>
    <ve-line
      :data="chartData"
      :settings="chartSettings"
      :after-config="afterConfig">
    </ve-line>
  </div>
</template>
<script>
import VeLine from 'v-charts/lib/line'
import echarts from 'echarts/lib/echarts'
export default {
  data () {
    return {
      chartData: {
        columns: ['日期', '余额', '比率'],
        rows: [
          { '日期': '1月1日', '余额': 123, '比率': 0.3 },
          { '日期': '1月2日', '余额': 1223, '比率': 0.6 }
        ]
      },
      chartSettings: {
        area: true
      }
    }
  },
  methods: {
    afterConfig (options) {
      options.series[0].areaStyle = {
        normal: {
          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
            offset: 0,
            color: 'rgb(255, 158, 68)'
          }, {
            offset: 1,
            color: 'rgb(255, 70, 131)'
          }])
        }
      }
      return options
    }
  },
  components: { VeLine }
}
</script>

from v-charts.

Anehta avatar Anehta commented on May 22, 2024

Thank you for answering this question so seriously. And use this prop isn't normal?

from v-charts.

Anehta avatar Anehta commented on May 22, 2024

em....i encountered an bug
<div style="display: flex"> <ve-line :data="chartData"></ve-line> </div>
In this code , chart will be disappear. @xiguaxigua

from v-charts.

xiguaxigua avatar xiguaxigua commented on May 22, 2024

Because the default width of V-Charts box is auto, and in your current scene, you need set width such as

<ve-line
  width="100%"
  :data="chartData"
  :settings="chartSettings"
  :after-config="afterConfig">
</ve-line>

from v-charts.

xiguaxigua avatar xiguaxigua commented on May 22, 2024

This problem is caused by flex-basis, as you knew, If you don't set the flex-basis, flex-basis value will be the width, and flex: 0 0 auto is the same as flex: none. So, echarts can't get dom width and won't draw anything. @Anehta

from v-charts.

Anehta avatar Anehta commented on May 22, 2024

thhhk u bro. im a newbee....

from v-charts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.