-
Notifications
You must be signed in to change notification settings - Fork 2k
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 can i use linearGradient #5
Comments
@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> |
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> |
Thank you for answering this question so seriously. And use this prop isn't normal? |
em....i encountered an bug |
Because the default width of V-Charts box is <ve-line
width="100%"
:data="chartData"
:settings="chartSettings"
:after-config="afterConfig">
</ve-line> |
This problem is caused by |
thhhk u bro. im a newbee.... |
You're welcome! Every question you meet can be asked here. |
like this :
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: '#5bcee2', }, { offset: 1, color: '#045d69', }]),
The text was updated successfully, but these errors were encountered: