Multiple y-axis with different scaling

1,876 views
Skip to first unread message

R.Seco

unread,
Aug 11, 2011, 4:36:41 AM8/11/11
to dygraphs-users
Hello,

I would like to create a line chart with multiple series having the
respective number of y-axis. The goal is to represent various
variables on the same chart but with different y scales. Is this
possible in the current library? If not, can you indicate me an
alternative solution? Thanks.

R.Seco

lrobb

unread,
Aug 11, 2011, 6:00:32 AM8/11/11
to dygraphs-users

R.Seco

unread,
Aug 11, 2011, 6:06:28 AM8/11/11
to dygraphs-users
In this example only to y-axis are shown. Is it possible to show more
than 2 y-axis (e.g. 4 y-axis on left side) with different colors and
scales?

Neal Nelson

unread,
Aug 11, 2011, 6:11:35 AM8/11/11
to dygraphs-users
I added the capability to have as many independent axes as you like, which we use in production. Only one axis is currently displayed at a time, coloured to match the data series. Unfortunately my changes have not been accepted back into the project.

You could always use my branch if you like, but the main line has developed further since then.

Here's the link to my changes: https://github.com/danvk/dygraphs/pull/53

R.Seco

unread,
Aug 11, 2011, 9:09:30 AM8/11/11
to dygraphs-users
Thank you for your help Neal Nelson.

Dan Vanderkam

unread,
Aug 11, 2011, 4:06:41 PM8/11/11
to ricard...@gmail.com, dygraphs-users
I've always been reluctant to support >2 y-axes in dygraphs. If you
have three or more y-axes on a single chart, it's usually a sign that
you need to re-think what you're charting. This is a fairly common
restriction. Microsoft Excel only supports two y-axes, for instance.

If you need to do this, you can work around the restriction by
re-scaling your data and undoing the scaling in a valueFormatter. Or
at least you will be able to soon:
http://dygraphs.com/preview/tests/multi-scale.html

I'm hoping to integrate the changes to valueFormatter in the next week.

- Dan

R.Seco

unread,
Aug 17, 2011, 4:03:13 PM8/17/11
to dygraphs-users
Hi Neal,

I'm using the capability you developed and suggested. I would like to
know if it is possible to dynamically change the y-axes scales. In the
example you present, "3 plots, one Y axis shown (fixed scales)", you
predefine the y-axis max and min values. How could I dynamically
define the different axis limits with, for example, html text boxes?
Thank you for your help.

R.Seco

JohnV

unread,
Sep 14, 2016, 5:21:17 PM9/14/16
to dygraphs-users, katzen...@googlemail.com
Hi Neal.  We also have a need for multiple Y-axis support, and I wanted to try your solution.  I've downloaded your changes, but when I try to generate the dygraph-combined.js file by running generate-combined.sh, it just creates an empty file.  Any idea what I might be doing wrong?


vanessa

unread,
Feb 13, 2024, 7:36:49 AMFeb 13
to dygraphs-users
Hi everyone,
I am currently using Dygraph 2.2.1 and I need to have multiple y-axis (more then 2) as aked by R.Seco. 
I tried to perform the re-scaling suggested by Dan, but every time the y-axis range is changed (feature available to the user of my charts), I need to re-scale all the data in the chart.
Is there any another solution available that would not involve all these computations?
Thanks in advance for any help.
Reply all
Reply to author
Forward
0 new messages