2017-10-11 151 views
3

我已經使用react-highcharts創建了折線圖。這就是它的外觀:lineChart。現在,我想線下加色填充漸變,這是我在做什麼:漸變填充react-highcharts的折線圖

render() { 
    let config = { 
    chart: { 
     animation: { 
     duration: 1000 
     } 
    }, 
    plotOptions: { 
     area: { 
     lineWidth: 1, 
     marker: { 
      enabled: false, 
      states: { 
      hover: { 
       enabled: true, 
       radius: 5 
      } 
      } 
     }, 
     shadow: false, 
     states: { 
      hover: { 
      lineWidth: 1 
      } 
     } 
     } 
    }, 
    rangeSelector: { 
     buttons: [{ 
     type: 'month', 
     count: 1, 
     text: '1m' 
     }, { 
     type: 'month', 
     count: 3, 
     text: '3m' 
     }, { 
     type: 'month', 
     count: 6, 
     text: '6m' 
     }, { 
     type: 'year', 
     count: 1, 
     text: '1y' 
     }, { 
     type: 'all', 
     text: 'All' 
     }], 
     selected: 0, 
     inputEnabled: false, 
    }, 
    title: { 
     text: 'Progress Chart' 
    }, 
    series: [{ 
     name: 'Account Balance', 
     data: this.getProgressData(), 
     type: 'area', 
     fillColor: { 
     linearGradient: [0, 0, 0, 300], 
     stops: [ 
      [0, '#4286f4'], 
      [1, '#ffffff'] 
     ] 
     }, 
     tooltip: { 
     valueDecimals: 2 
     } 
    }], 
    yAxis: { gridLineWidth: 0 }, 
    xAxis: { gridLineWidth: 2 }, 
    }; 

    return(
    <div> 
     <ReactHighstock config={config}/> 
    </div> 
) 
} 

我得到的梯度工作,但問題是我得到一個平坦的圖表沒有長槍,這樣:lineChartWithGradient。我希望我的圖表看起來像前一個,但是使用漸變色填充。

+0

不能找出問題,但檢查了這https://stackblitz.com /編輯/反應-highcharts-工具提示格式化-zh5b8y –

回答