question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

multipe y axis for same dataset

See original GitHub issue

I’m trying to get ticks on both the right an left of the chart that use the same data sets. A simple example would be time on the x axis, miles on the left and km on the right. but more specifically I’m working on a experience graph for an rpg like so like so

the left is actually experience earned by the character and the right is level. I’ve achived this with

    ticks: {
        min: 0,
        max: 300000, // set dynamically to equal the left y-axis (max experience)
        stepSize: 1,
        callback: function (value, index, values) {
        const lvlIndex = lvlXP.indexOf(value);
        if (lvlIndex !== -1) {
            return 'lvl ' + (lvlIndex + 2);
        }
   }

but considering that the experience could be as high as 500,000 this requires that callback is called up to 500k times and runs incredibly slowly

Is there an efficient was to handle this? I’ve looked at the documentation but havn’t ben able to find anything relevant to this

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
kurklecommented, Jan 14, 2020
0reactions
giancarlocpcommented, Jan 21, 2021

Yes, it is possible. I was missing to set yAxes array properly. And for custom axis legend color, we need ticks: { fontColor:… }

yAxes: [{
  type: "linear",
  display: true,
  id: "y-axis-1", // default position -> left
  ticks: { fontColor: "#F57" }, // this here
},{
  type: "linear",
  display: true,
  id: "y-axis-2",
  position: "right",
  ticks: { fontColor: "#3AE" }, // this here
  gridLines: { drawOnChartArea:false } // only want the grid lines for one axis to show up
}],
Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding the Dual Y Axis in Charts - Oracle Help Center
In the Chart General Properties, set Toggle Dual Y Split to one of the following: On—creates a secondary Y-Axis in the same chart....
Read more >
How to plot single data with two Y-axes (two units) in Matplotlib?
How to plot single data with two Y-axes (two units) in Matplotlib? · Set the figure size and adjust the padding between and...
Read more >
Display Data with Multiple Scales and Axes Limits - MathWorks
Learn about techniques for visualizing data with multiple x- and y-axes, multiple colorbars, or with an x-axis that is broken into intervals.
Read more >
How to plot two data sets of different scales in same graph in ...
This video explains about How to plot two data sets of different scales in same graph in excel.How to add a second Y...
Read more >
How To Add A Second Y Axis To Graphs In Excel - YouTube
In this tutorial, I'm going to show you how to add a second Y axis to a graph by using Microsoft Excel. Adding...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found