plotly.js icon indicating copy to clipboard operation
plotly.js copied to clipboard

Place labels inside chart

Open CalvinFernandez opened this issue 10 years ago • 10 comments

image

Is it possible to place labels inside chart the way they appear on the Y axis above? It seems like axis labels could support an 'inside' and 'outside' designation the same way they're implemented with ticks.

CalvinFernandez avatar Aug 23 '16 22:08 CalvinFernandez

That's not possible at the moment unfortunately.

@CalvinFernandez I can turn this issue into a feature request if you like.

etpinard avatar Aug 24 '16 13:08 etpinard

@etpinard is this the correct place for feature requests? I wasn't sure -- If you would like I can submit a PR for this

CalvinFernandez avatar Aug 24 '16 15:08 CalvinFernandez

is this the correct place for feature requests?

Yes. Absolutely.

If you would like I can submit a PR for this

that would be amazing.

etpinard avatar Aug 24 '16 15:08 etpinard

deleting all +1s.

etpinard avatar Mar 12 '18 15:03 etpinard

@etpinard

First, hi, I'm new to contributing so I wanted to run this idea by you if that's ok. I've created a basic implementation for this locally by adding a field in yaxis called ticklabelalignment which can be set to "inside" or "outside". If it is "inside" then you need to make some changes in axes.js (see image below).

This is similar to what you suggested in #883 for the tickanchor. It would not cover positioning the label above or below the tick though (#1882), its only for the horizontal alignment but we could do something similar for the vertical alignment. This seems to work well with left or right y-axis and subplots.

screen shot 2018-06-12 at 9 57 21 pm

ricazhang avatar Jun 13 '18 05:06 ricazhang

As I understand these changes aren't in the current version? (I'm working with 1.40, using yaxis: { ticklabelalignment: 'inside' })

As this is a much needed change for mobile (maximizing screen real estate utilization), I'd very much like to see this feature. Many apps use this: https://www.designyourway.net/diverse/6/uicharts/1997994.jpg https://cdn.dribbble.com/users/4620/screenshots/2576470/linegraphdashmobile_1x.png Or Google Image search for "mobile graph"

@etpinard There seems to be a solution (or at least partially, for horizontal alignment, which is the most important one in most use cases), which from the looks of it does not pose a high risk for conflicts, can this please be verified and merged to the master branch?

rms95 avatar Aug 18 '18 12:08 rms95

@rms95 Yes they aren’t in the current version. I haven’t merged my change to master. You’re welcome to try out my version of it with that alignment flag though!

ricazhang avatar Aug 18 '18 16:08 ricazhang

I looked at the /dist/plotly.min.js file in your latest commit files, though that doesn't seem to include the new code. I haven't compiled projects like this before, if you have the fully build file ready to grab, would mind sending it as attachment here?

rms95 avatar Aug 18 '18 16:08 rms95

Any update on this feature?? It would be great to have label alignment on the y axis

nirmal495 avatar Dec 06 '18 05:12 nirmal495

Closed by #5275

alexcjohnson avatar Mar 03 '21 16:03 alexcjohnson