15776869115 commented on issue #18109:
URL: https://github.com/apache/echarts/issues/18109#issuecomment-1366427904

   > 
   
   import React from 'react';
   import { Line } from '@ant-design/plots';
   import servicePath from '@/config/api';
   
   class SrmLine extends React.Component{
     state = {
       data:[],
       clusterId:this.props.clusterId,
       trendType:this.props.trendType
     }
     componentDidMount() {
       this.asyncFetch();
     }
     componentWillReceiveProps(nextProps, nextContext) {
       this.setState({
         clusterId:this.props.clusterId,
         trendType:this.props.trendType
       },() => {
        // console.log('props.clusterId'+this.props.clusterId + 'demoline the 
state.clsueterid'+this.state.clusterId);
         this.asyncFetch();
       })
     }
   
     asyncFetch = () => {
       fetch(servicePath.clusterTrendData,{
         method:'post',
         headers: {
           'Content-Type': 'application/json'
         },
         body:JSON.stringify 
({clusterId:this.state.clusterId,clusterName:'DorisDB',trendType: 
this.state.trendType})
       })
         .then((response) => response.json())
         .then((data) => this.setState({
           data :data.data}))
         .catch((error) => {
           console.log('fetch data failed', error);
         });
     };
   
     render() {
   
       const config = {
         data:this.state.data,
         xField: 'date',
         yField: 'value',
         seriesField: 'category',
         yAxis: {
           label: {
             // 数值格式化为千分位
             formatter: (v) => `${v}`.replace(/\d{1,3}(?=(\d{3})+$)/g, (s) => 
`${s},`),
           },
         },
         color: ['#1979C9', '#D62A0D', '#FAA219'],
       };
   
       return <Line {...config} />;
     }
   }
   export default SrmLine;
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to