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

Chart size problem #37

Closed
gokhanoner opened this issue Nov 24, 2016 · 9 comments
Closed

Chart size problem #37

gokhanoner opened this issue Nov 24, 2016 · 9 comments
Labels
Milestone

Comments

@gokhanoner
Copy link
Contributor

When set the chart size using setSizeFull(), i expect to see the chart sized correctly, but instead it overflows and some part is not seen on the screen.

@moberwasserlechner
Copy link
Owner

Could you please provide a example because in the demo I don't see that behaviour.

@dyorgio
Copy link

dyorgio commented Jan 4, 2017

Same problem here, but with two behaviors:

When navigate to view (Problem):
captura de tela 2017-01-04 as 16 21 44

When call browser refresh (Ok):
capura de tela 2017-01-04 as 16 21 59

No mystery on layout, just setSizeFull() on Chart component.

@moberwasserlechner
Copy link
Owner

@dyorgio thanks for the clarification

@dyorgio
Copy link

dyorgio commented Jan 5, 2017

@moberwasserlechner @gokhanoner
If you put on charts-connector.js this line:

canvas.setAttribute('height', '100%');

The problem stops, but, in my retina display (HDPi), the chart appears smooth (bad rendered).

@moberwasserlechner
Copy link
Owner

@dyorgio
Your retina display issue might be related to chartjs/Chart.js#3575.

Could you please share your configuration, because in the mentioned issue resizing problems appear if 'responsive' option was set to false.

@dyorgio
Copy link

dyorgio commented Jan 5, 2017

@moberwasserlechner I made new test with this modification:

  • Update Chartjs to 2.4.0.

Now the problem only occurs if I use

chart.maintainAspectRatio(true).

But, using

chart.maintainAspectRatio(false)

works perfectly to me, including responsive resizing.

Animations stopped to work using % sizes, if I change to pixels animations works ok.

@moberwasserlechner moberwasserlechner added this to the 0.4.0 milestone Feb 8, 2017
@Maegar
Copy link

Maegar commented Feb 21, 2017

@moberwasserlechner
I investigate some time for analysing why the chart is not sized correctly
I find the following in chartjs-connector.js:
if (state.width > 0) {

The width in state object is a string (e.g. 100%) state.width > 0 will always return false. If you change the line to state.width.length > 0 or something similar it should work.

Best regards

@moberwasserlechner
Copy link
Owner

moberwasserlechner commented Feb 23, 2017

@Maegar @dyorgio thx for that. I hope I can get a new release ready soon.

@gokhanoner
Copy link
Contributor Author

I'm just looking to the demo site, pie with data refresh example. When I refresh the data, chart size incorrectly until you resize the browser.

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

4 participants