轻量级图表:timeScale更改setData上的visibleRange

问题描述

我需要加载数据直到填充可见区域。但是在$repository = $this->getDoctrine()->getRepository(Application::class); $query = $repository->createqueryBuilder('request'); $query ->andWhere($query->expr()->Andx( $query->expr()->eq('request.curr',':curr'),$query->expr()->in('request.country',':JSONcountry'),$query->expr()->in('request.type',':JSONtype'),$query->expr()->in('request.job',':JSONjob'),)) ->setParameter('curr',true) ->setParameter('JSONcountry',$app->getCountry()) ->setParameter('JSONtype',$app->getType()) ->setParameter('JSONjob',$app->getJob()); echo $query; $query = $query->getQuery(); $applications = $query->getResult(); return $applications; 上,图形会更改可见区域,从而导致无休止的数据加载。看起来像这样https://jsfiddle.net/beholderrk/916g3tcf/3/

是否有任何方法可以使setData不会导致setData可见区域的移位?

解决方法

当您通过setData设置数据并且库移动可见范围时,似乎出现了一个错误,我认为它不应该这样做(它的工作方式就好像您看到最后一个条形一样)。我建议您file an issue on github,以便我们将其标记为错误并在将来的版本中修复。

,

我对您想达到的目标有forked the fiddle。您只需要添加:

chart.applyOptions({
  priceScale:{
    autoScale: false,}
})
声明后的

。如果您想更改价格范围,我还添加了一个注释部分:

// To set a different scale
  /*autoscaleInfoProvider: () => ({
    priceRange: {
      minValue: 170,maxValue: 300,},}),*/

我没有发现动画停止的任何条件。仅当您按下stop按钮时。您需要添加该部分。