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

[HELP NEEDED] "Error: yAxis "0" not found" console error for mixed line and Bar graph. #398

Open
Harrish-Selvarajah opened this issue May 18, 2023 · 1 comment

Comments

@Harrish-Selvarajah
Copy link

Harrish-Selvarajah commented May 18, 2023

I'm getting this console error when I try to add the third axis and give yaxis index to the line graph data.

image

`widgetData: [
            {
              name: 'AssignmentHours.Hours',
              type: 'bar',
              data: getChartData(
                [20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240],
                'serviceSpentBudget',
                ColorPalette.HoursSpent
              ),
              yAxisIndex: 0,
            },
            {
              data: getChartData(
                [20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240],
                'serviceHours',
                ColorPalette.HourBudgeted
              ),
              name: 'AssignmentHours.HoursBudget',
              type: 'bar',
              yAxisIndex: 0,
            },
            // TODO: Replace fake values with BE api values when available.
            {
              name: 'AssignmentDashboard.AccumulatedSpent',
              type: 'line',
              data: [20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240],
              color: '#0C373C',
              yAxisIndex: 1,
            },
            {
              name: 'AssignmentDashboard.AccumulatedBudget',
              type: 'line',
              data: [20, 30, 50, 70, 85, 105, 130, 150, 180, 220, 240, 260],
              color: '#20909E',
              yAxisIndex: 1,
            },
          ],`
`  private setXAxis() {
    this.chartInstance.setOption({
      xAxis: {
        type: 'category',
        data: this.dataLabels?.map((label: string) => {
          return this.translateService.instant(label);
        }),
        axisLine: {
          lineStyle: {
            type: this.widget.axisLineStyle,
          },
        },
        axisTick: {
          show: this.widget.axisTick,
        },
        axisLabel: {
          color: !this.hasData ? palettes.primary[200] : '',
        },
        show: this.hasData,
      },
      yAxis: [
        {
          splitLine: {
            lineStyle: {
              type: this.widget.splitLineStyle,
            },
          },
          axisLabel: {
            show: this.hasData,
          },
        },
        {
          name: 'S',
          splitLine: {
            lineStyle: {
              type: this.widget.splitLineStyle,
            },
          },
          axisLabel: {
            show: this.hasData,
          },
          min: 0,
          max: 25,
          // interval: 5,
        },
      ],
    });
  }`

Anyone has an idea on this ?

@Harrish-Selvarajah Harrish-Selvarajah changed the title "Error: yAxis "0" not found" console error for mixed line and Bar graph. [HELP NEEDED] "Error: yAxis "0" not found" console error for mixed line and Bar graph. May 18, 2023
@masum-mollik-rocketml
Copy link

@Harrish-Selvarajah Did you find any solution?

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

No branches or pull requests

2 participants