Tudor16c commented on issue #17789:
URL: https://github.com/apache/echarts/issues/17789#issuecomment-1286584305

   `    var series = [
           {
               yAxisIndex: 0,
               sampling: 'lttb',
               name: 'Pressure In',
               type: 'line',
               smooth: true,
               symbol: 'none',
               encode: {
                   x: 'Time',
                   y: 'Bar',
                   itemName: 'Time',
                   tooltip: ['Bar']
               },
               data: pressureIn,
               large: true,
               largeThreshold: 100,
           },
   
           {
               yAxisIndex: 1,
               sampling: 'lttb',
               name: 'Temperature Water',
               type: 'line',
               smooth: true,
               symbol: 'none',
               encode: {
                   x: 'Time',
                   y: '°C',
                   itemName: 'Time',
                   tooltip: ['°C']
               },
               data: temperatureWater,
               large: true,
               largeThreshold: 100,
           },
       ]
   
       const option = {
           legend: {
               show: true
           },
           tooltip: {
               trigger: 'axis',
               position: function (pt)
               {
                   return [pt[0] + 50, '10%'];
               },
               axisPointer: {
                   type: 'cross'
               },
               formatter: (params) =>
               {
                   var xTime = new Date(params[0].axisValue)
   
                   let tooltip = `<p>${xTime.toLocaleString()}</p> `;
   
                   series.forEach((serie, index) =>
                   {
                       let serieData = serie.data.find((data) =>
                       {
                           return data[0] == params[0].axisValue
                       })
                       tooltip += `<p><span 
style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:
 ${chart.getVisual({ seriesIndex: index }, 'color')}"></span>`
                   });
                   return tooltip;
               }
           },
           toolbox: {
               feature: {
                   dataZoom: {
                       yAxisIndex: 'none',
                   },
                   restore: {},
                   saveAsImage: {
                       show: true,
                       type: 'png',
                       name: props?.widget?.Machine?.name + '-' + props?.date
                   }
               }
           },
           xAxis: {
               type: 'time',
               boundaryGap: false
           },
           yAxis: [
               {
                   type: 'value',
                   name: 'Pressure',
                   alignTicks: true,
                   axisLabel: {
                       formatter: '{value} Bar'
                   },
                   axisLine: {
                       show: true,
                       lineStyle: {
                           color: '#91CC75'
                       }
                   },
               },
               {
                   type: 'value',
                   name: 'Temperature',
                   alignTicks: true,
                   axisLabel: {
                       formatter: '{value} °C'
                   },
                   axisLine: {
                       show: true,
                       lineStyle: {
                           color: '#5470C6'
                       }
                   },
               },
           ],
           dataZoom: [
               {
                   type: 'inside',
                   start: 0,
                   end: 100
               },
               {
                   start: 0,
                   end: 100
               }
           ],
           series: series
       };
   
   return (
     <ReactECharts option={option}
                   onChartReady={(chart) =>
                   {
                       setChart(chart);
                   }}
                   showLoading={loading}
               />
   )
   
   `


-- 
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