Skip to content
This repository has been archived by the owner on Jul 10, 2020. It is now read-only.

Stretched chart after refreshData() #50

Closed
hubertooo opened this issue Jun 10, 2017 · 6 comments
Closed

Stretched chart after refreshData() #50

hubertooo opened this issue Jun 10, 2017 · 6 comments
Labels
Milestone

Comments

@hubertooo
Copy link

When I trigger refreshData() chart is is stretched.
Browser refresh, browser resize ... all is perfect.

What am I dooing wrong?

Vaadin 7.7.9
vaadin-chartjs 0.4.0

A bit of source code

   private void buildChart() {
           
      configChart = new LineChartConfig();
      
      configChart.data()
              .addDataset(new LineDataset().label("qwerty").backgroundColor("rgba(151,187,145,0.5)"))
              .and()
              .options()
              .responsive(true)
              .title()
              .display(true)
              .and()
              .tooltips()
              .and()
              .scales()
              .add(Axis.X, new DefaultScale()
                      .stacked(true))
              .add(Axis.Y, new DefaultScale()
                      .stacked(true))
              .and()
              .done();

      
      
      Dataset<?, ?> ds = configChart.data().getDatasetAtIndex(0);
      chartLineDataSet = (LineDataset) ds;
      
      
      chart = new ChartJs(configChart);
      chart.setJsLoggingEnabled(true);
      chart.setSizeFull();
   }

   private void chartDataRefresh(Long offset) {
      dataSNR = crDrI122Repo.getAllSnrs();
      
      dataTaskDateString = Util.dateArrayToStringarray(crDrI122Repo.getAllTaskDates());
      configChart.data().labels(dataTaskDateString);

      chartLineDataSet.dataAsList(Util.floatListToDoubleList(dataSNR));
      
      chart.configure(configChart);
      chart.refreshData();
      
   }

OK
huberto_awtfm_agfapoland_2017-06-10_18-32-19

after reload
huberto_awtfm_agfapoland_2017-06-10_18-33-12

ps. vaadin chart js = great job

@moberwasserlechner moberwasserlechner added this to the 1.0.0-RC1 milestone Jun 11, 2017
@moberwasserlechner
Copy link
Owner

This is a bug, unfortunatly you can't do sth against it.

@moberwasserlechner
Copy link
Owner

Upgrade to Chart.js 2.6 does not fix the problem. I guess after refresh I have to trigger a repaint or sth similar.

In the demo moving on of the splitters also triggers the repaint and the chart is displayed correctly.

@moberwasserlechner
Copy link
Owner

The problem is that after the refresh the width attribute of the canvas is set to 100%.

@moberwasserlechner
Copy link
Owner

moberwasserlechner commented Jun 14, 2017

Already mentioned in #23 and #37

@hubertooo
Copy link
Author

sorry for delay ... vacation :)

thx for fast respons
will you put 1.0.0 to http://jcenter.bintray.com/com/byteowls/vaadin-chartjs/ repository?
only 0.4.0 is awaliable

@moberwasserlechner
Copy link
Owner

moberwasserlechner commented Jun 15, 2017

As soon as the release is ready I will ;) I will publish the release and annonce it on Twitter as well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants