Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arduino 使用Vaadin Flow实时更新ApexChart_Arduino_Esp8266_Vaadin Flow_Openjdk 11 - Fatal编程技术网

Arduino 使用Vaadin Flow实时更新ApexChart

Arduino 使用Vaadin Flow实时更新ApexChart,arduino,esp8266,vaadin-flow,openjdk-11,Arduino,Esp8266,Vaadin Flow,Openjdk 11,我现在要介绍的代码是用vaadin和ApexChart插件编写的,我只想实时更新线型图,我在MainView中有@Push注释和一个每秒运行的ScheduledExecutorService Vaadin版本is14.1.27 Apexcharts插件 com.github.com 阿佩克斯哈特 2.0.0.beta9 ApacheTomcat/9.0.27 我提出一个简单的请求,然后在access(()->)方法中,最后调用chart.updateSeries() 代码 public vo

我现在要介绍的代码是用vaadin和ApexChart插件编写的,我只想实时更新线型图,我在MainView中有
@Push
注释和一个每秒运行的ScheduledExecutorService

Vaadin版本is
14.1.27

Apexcharts插件


com.github.com
阿佩克斯哈特
2.0.0.beta9
ApacheTomcat/9.0.27

我提出一个简单的请求,然后在
access(()->)
方法中,最后调用
chart.updateSeries()

代码

public void updateChar(){
最终ApexCharts图表=ApexChartsBuilder.get().withChart(ChartBuilder.get())
.withType(Type.line)
.withAnimations(AnimationBuilder.get())
.withEnabled(真)
.带缓和(缓和。线性)
.Withdynamicanition(dynamicanitionbuilder.get()
.最高速度(1000)
.build())
.build())
.build())
.withDataLabels(DataLabelsBuilder.get()
.withEnabled(错误)
.build())
.with系列(新系列(0))
.withXaxis(XaxiBuilder.get()
.withCategories()
.带最大值(10.0)
.build())
.build();
图表:设定高度(“400px”);
图表:设置宽度(“400px”);
schedule.scheduleAtFixedRate(()->{
试一试{
最终CompletableFuture cf=HttpClient
.newBuilder()
.build()
.sendAsync(HttpRequest
.新造船工(新URI(湿度))
.GET()
.version(HttpClient.version.HTTP_2)
.build(),
HttpResponse.BodyHandlers.ofString())
.thenApplyAsync(HttpResponse::body);
cf.whenCompleteAsync((数据,错误)->{
if(getUI().isEmpty())返回;
if(Objects.nonNull(错误)){
cf.异常完全(错误);
getUI().get().access(()->{
显示(“错误:+错误”);
});
}否则{
if(getUI().isEmpty())返回;
getUI().get().access(()->{
最终SecureRandom=新SecureRandom();
最终系列=新系列(25.2,30.2,25.77,45.66,60.00,55.5);
最终系列1=新系列(30.3,34.10,20.11,12.15,55.66,82.5,64.35,100.4,77.66,14.32,25.77);
最终系列2=新系列(25.5,55.3,44.5,99.6,10.3,44.6,36.6);
最终系列[]随机系列=新系列[]{Series,serie1,serie2,Series};
//图表.更新序列(radomSeries[SECURE_RANDOM.nextInt(randomSeries.length)];
图表.更新系列(新系列(数据));
});
}
},行政长官)
.join();
}捕获(URISyntaxException e){
抛出新的RuntimeException();
}
},1,1,时间单位为秒);
} 
不幸的是,结果并不像预期的那样,使用相同的代码,我能够更新
TextFields