o-az
o-az

Reputation: 633

Reverse one chart and leave the other unreversed - Synchronized highcharts

In order to reverse a chart you have to add reversed: true. It can be done either on the xAxis or the yAxis. In this example provided by Highcharts: https://jsfiddle.net/omaraziz/zg516ruk/ when I add reversed, it reverses all the charts. How can I reverse only one chart? More generally, what is the proper way to do more customization on one chart and not the other when the two are synchronized? I chose synchronized because I wanted the values from both to be displayed at the same time when scanning from right to left and vice versa.

For now every time I change the legend position, reverse xAxis or yAxis, play with the tooltip, set a max and min for the yAxis, etc. it does it to both.

Here's my JSON data, in case the way to do it is through the JSON file: https://omaraziz.me/CC-chart/activity.json

Upvotes: 0

Views: 80

Answers (1)

ppotaczek
ppotaczek

Reputation: 39139

You can use index variable i to recognize the chart. For example the IFFE function below return true only for the second chart:

            xAxis: {
                reversed: (function() {
                    return i === 1
                })(),
                ...
            }

Live demo: https://jsfiddle.net/BlackLabel/7fx6jdnw/

Upvotes: 0

Related Questions