hugomeduarte
Posts: 3
Joined: Fri Jun 03, 2022 2:29 pm

Series not showing when added more than one

Hello, I'm trying to create a stockchart with 2 different series which the data are in the images bellow.

Image
Image

As you can see the xAxis is the same on both data and what changes are the yAxis.

Here is my code:

Code: Select all

chart = Highcharts.stockChart('container', {
        rangeSelector: {
            selected: 1
        },
        credits: {
            enabled: false
          },
          yAxis: [{
              title: {
                text: 'First yAxis'
              }
            },
            {
              title: {
                text: 'Second yAxis'
              },
              opposite: false
            }
          ],
          series: [{
              name: 'One',
              color: 'green',
              data: data
            },
            {
              name: 'Two',
              color: 'red',
              data: data2,
              yAxis: 1
            }
          ]
    });

As you can see in the image below, the yAxis on both right and left side are correct from my data but the chart don't appear! If I stay with only one series it works but not with more than one.

Image

Can someone help me? Thanks in advance!
hugomeduarte
Posts: 3
Joined: Fri Jun 03, 2022 2:29 pm

Re: Series not showing when added more than one

Hello, a quick edit.
The yAxis is between the interval of both data if I use only one axis. Example: https://i.imgur.com/huSqxv8.png
Probably makes more sense this way, but the chart still don't appear.
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: Series not showing when added more than one

Hello hugomeduarte!
Welcome to our forum and thanks for contacting us with your question!

For datetime axes, the X value is the timestamp and it must be in milliseconds since 1970. The attached image shows that it is in a date format, not in milliseconds. You can check the demo below to see an example.

Demo: https://jsfiddle.net/BlackLabel/avgnLs62/
API Reference: https://api.highcharts.com/highstock/series.line.data.x

Let me know if that helps you.
Kind regards!
Hubert Kozik
Highcharts Developer
hugomeduarte
Posts: 3
Joined: Fri Jun 03, 2022 2:29 pm

Re: Series not showing when added more than one

It worked, thank you so much hubert!
I though the data was right because the charts with one series were working with date format. Now I don't know if that was suppose to happend...

Regards!
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: Series not showing when added more than one

You're welcome! In case of any further questions, feel free to contact us again.
Hubert Kozik
Highcharts Developer

Return to “Highcharts Stock”