efenadir
Posts: 31
Joined: Sat Jul 10, 2021 6:32 pm

Add multiple condition to same rule (responsive)

Hi,

I want to add multiple condition to same rule in responsive. Actually, I want to set a rule between 968px and 1080px for example. (like an interval) These two approaches couldn't work:

Code: Select all

responsive: {
      rules: [
        {
          condition: {
            maxWidth: 1080,
            minWidth: 968,
          },
          chartOptions: {
            chart: {
              width: 120,
            },
          },
        },
      ],
    },

Code: Select all

responsive: {
      rules: [
        {
          condition: {
            maxWidth: 1080,
          },
          condition:{
          minWidth: 968,
          }
          chartOptions: {
            chart: {
              width: 120,
            },
          },
        },
      ],
    },
How can I achieve that?

Thank you for your consideration!
magdalena
Posts: 517
Joined: Tue Aug 24, 2021 1:32 pm

Re: Add multiple condition to same rule (responsive)

Hi,

Thanks for contacting us with your question!

Unfortunately, responsive.rules don't work in this way with width or height.
If you want to specify a rule of chart width, you need to use the addEventListener() method to listen for the browser window resize event.

Demo:
https://jsfiddle.net/BlackLabel/40qfnyxj/

Regards!
Magdalena Gut
Developer and Highcharts Support Engineer

Return to “Highcharts Stock”