Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(charts): line charts wouldn’t render with empty data set #138

Merged
merged 1 commit into from
Nov 9, 2016
Merged

fix(charts): line charts wouldn’t render with empty data set #138

merged 1 commit into from
Nov 9, 2016

Conversation

fcoury
Copy link
Contributor

@fcoury fcoury commented Nov 8, 2016

Description

The line chart wouldn’t render at all if an empty array is used on the [data] attribute, the following error would be thrown:

TypeError: Cannot read property 'xValue' of undefined

I narrowed it down to the translation of the data, where it was assumed that the value would be defined at all times, which isn’t the case if data is an empty array.

This fix solves the problem.

What's included?

  • Fix for line chart with empty data sets

Test Steps

  • open src/app/components/components/charts.component.html
  • change the first <td-chart-line, replacing dataSrc="..." by [data]="[]"
  • visit the charts component page
Screenshots or link to CodePen/Plunker/JSfiddle

The error is the following:

Error for empty line charts

The line chart wouldn’t render at all if an empty array is used on the
[data] attribute, the following error would be thrown:

TypeError: Cannot read property 'xValue' of undefined

I narrowed it down to the translation of the data, where it was assumed
that the value would be defined at all times, which isn’t the case if
data is an empty array.

This fix solves the problem.
@emoralesb05 emoralesb05 merged commit 5c1df45 into Teradata:develop Nov 9, 2016
@emoralesb05 emoralesb05 added this to the Alpha 0.9 milestone Nov 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants