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

Add data-binding for yAxis #3

Merged
merged 1 commit into from
Feb 15, 2016
Merged

Add data-binding for yAxis #3

merged 1 commit into from
Feb 15, 2016

Conversation

sorin-davidoi
Copy link
Contributor

Decided to remove the previous value for yAxis. However, this could remain and be extended by the user-supplied object.

@avdaredevil
Copy link
Owner

Any reason for this? What problem were you running into with this design?

@sorin-davidoi
Copy link
Contributor Author

Maybe I'm missing something. I was trying to add a custom formatter for the Y axis, something like:

yAxis: { type: Object, value: {
          title: { text: null },
          gridLineWidth: 0,
          tickInterval: 25,
          maxPadding: 0,
          labels: { formatter: formatYAxisLabel }
        }},

@avdaredevil
Copy link
Owner

The API provided for this is:

app.$.myChart._chart.yAxis[0].update({
    type: Object,
    value: {
          title: {text: null},
          gridLineWidth: 0,
          tickInterval: 25,
          maxPadding: 0,
          labels: {formatter: formatYAxisLabel}
    }
})

Let me know if that does not work for you. I have a demo page reserved for pull requests, so I can put it as a demo.

@sorin-davidoi
Copy link
Contributor Author

Thanks for the example. That works, but I feel that is exhibits a few drawbacks:

  • accessing the underlying implementation is kind of a hack; the purpose of the web-component should be to hide the actual implementation
  • the overhead of setting up an observer and calling update again if I want to change one of the properties
  • taking extra care to check that app.$.myChart is defined (in my case, it is inside a dom-if template)
  • inconsistency with the x-axis API

@avdaredevil
Copy link
Owner

Good points. Merging.

avdaredevil added a commit that referenced this pull request Feb 15, 2016
@avdaredevil avdaredevil merged commit 8c2cc3e into avdaredevil:master Feb 15, 2016
avdaredevil added a commit that referenced this pull request Feb 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants