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

Added output 'optionsError' #240

Merged
merged 1 commit into from
Jul 24, 2020
Merged

Added output 'optionsError' #240

merged 1 commit into from
Jul 24, 2020

Conversation

trajnisz
Copy link
Contributor

Added output 'optionsError' to give control over error handling in .setOption(). This could be beneficial especially when options are set dynamically in application. It gives opportunity to inform with custom error about incorrect options or to somehow change options dynamically again.

Simple usage example:
HTML:

<div echarts [options]="chartOption" (optionsError)="onOptionsError($event)"></div>

TS:

  chartOption: EChartOption = {
    xAxis: {
      type: 'category',
      data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    },
    series: [
      {
        data: [820, 932, 901, 934, 1290, 1330, 1320],
        type: 'line',
      },
    ],
  };

  onOptionsError(error){
    console.log('do something'); // We will get error because no yAxis is specified
  }

@trajnisz
Copy link
Contributor Author

@xieziyu

@xieziyu xieziyu merged commit 535bb6c into xieziyu:master Jul 24, 2020
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.

2 participants