[英]Echarts markLine with stacked series
我正在嘗試使用 markLine 選項用兩條線系列標記圖表的頂部。 這些線系列是堆疊的,但是當我嘗試使用選項type: max
頂部圖形的標記線顯示在圖形下方,因為該值低於顯示的值(我附上圖像以更清晰地顯示)。
如何將 markLine 放在圖表頂部? 我已經看到了y
參數,但我必須把它放在我認為不可能的像素中。
這是我對兩個 markLines 的配置:
// First markLine
const markLineAhorro = {
data: [
{
type: 'max',
label: {
position: 'middle',
formatter: params => {
return `Sólo tienes que invertir: ${params.value.format()} €`
}
},
lineStyle: {
color: '#212529'
}
},
]
}
// Second markLine (the one on the top)
const markLineRentabilidad = {
data: [
{
type: 'max',
label: {
position: 'middle',
formatter: params => {
return `Con tu inversión obtienes: ${params.value.format()} €`
}
},
lineStyle: {
color: '#212529'
}
}
]
}
我找到的解決方案是使用coord
參數來手動設置我想要的起點和終點的標記。 我使用xAxis
參數來設置 markLine 的起點和終點以及我想要設置yAxis
的最大值。
然后我調整value
參數以顯示我想要的值。
const markLineRentabilidad = {
data: [
[
{
// Use the same y coord with starting and ending point
coord: [0, patrimonioMaximo.toString()],
value: rentabilidad[rentabilidad.length - 1],
},
{
coord: [añosGrafica.length - 1, patrimonioMaximo.toString()],
}
]
]
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.