Comments (6)
@alexcjohnson, it is the same version as you have in the picture, v2.27.1.
from react-plotly.js.
Thanks for looking at this for me. I ran the following in playcode.io. The result are as expected:
import React from 'react';
import Plot from "react-plotly.js";
export function App(props) {
var data = [
{
x: ['Apples', 'Oranges', 'Watermelon', 'Pears'],
y: [1, 2, 3, 4],
z: [[2, 5, 6, 7], [3, 5, 6, 7], [5, 6, 1, 0], [1, 3, 4, 9]],
type: 'heatmap'
}
];
var layout = {
autosize: false,
width: 500,
height: 500,
yaxis: {
title: 'Y-axis Title',
ticktext: ['long label','Very long label','3','label'],
tickvals: [1, 2, 3, 4],
tickmode: 'array',
automargin: true,
titlefont: { size:20 },
},
};
return (
<div>
<Plot data={data} layout={layout}></Plot>
</div>
);
}
But putting the exact code in my source didn't work as expected.
As I am new to react, I cannot think of any other settings or configs that could affect this. I even tried removing the whole content of my App.css
file.
from react-plotly.js.
Ah, nice find! I'll bring that back into the plotly.js repo and we can see about finding a fix (and/or a workaround)
from react-plotly.js.
@saber1440 what plotly.js version do you have? You can verify it by hovering on the plotly logo:
from react-plotly.js.
hmm ok - the only other thing I can think of is sometimes if you render the plot too soon after page load it doesn't have the font yet and gets the sizing wrong - but that doesn't really look like what's going on here, that's usually only off by a little bit whereas this looks like it's not trying to automargin at all.
I suppose you can check whether plotly.js really got the right settings by looking at _fullLayout
in the JS console, ie:
> document.querySelector('.js-plotly-plot')._fullLayout.yaxis.automargin // assuming there's only one plotly plot on your page
< true
Normally there's no difference between how figures work in react-plotly.js and plain plotly.js, and your figure works fine for me in plain plotly.js https://codepen.io/alexcjohnson/pen/gOErOzO
from react-plotly.js.
@alexcjohnson, I figured out what is causing this issue. It is setting the body dir
that I have for internationalization.
For example, try this in the example you provided in codepen.io
:
<body dir='rtl'>
<div id="myDiv"></div>
</body>
Any thoughts on how I can fix this?
from react-plotly.js.
Related Issues (20)
- How do I configure spikedistance? HOT 1
- Depreciated in favor of Angular? HOT 2
- Update plotly.js to include the latest version HOT 1
- onDoubleClick does not work in 3D mesh HOT 1
- Support Synchronizing of zoom & hover for multiple charts on the same page HOT 2
- ranges does not get computed when same data is used but Plot is updated
- Can't resolve 'react-plotly.js' in HOT 1
- onUpdate - reset the zoom in Nextjs (React) HOT 2
- Rangeselector buttons flashing
- Plotly.restyle breaks onClick handlers
- Can't disable sunburst default animation HOT 1
- Is layout.height really disallowed when layout.autosize=true ?
- Need to extract `.default` before using `createPlotlyComponent` HOT 1
- Request for Kernel Density Estimate Plot Feature in react-plotly HOT 1
- Chart is cropped. HOT 1
- How can I use animate method ?
- How do I use Plotly.Fx.hover with react-plotly.js?
- Heatmap not showing HOT 1
- Clickmode "event+select" activated and Clicking outside of Graph calls onUpdate incorrectly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-plotly.js.