Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix width of chart when adjustToWidth is true and allow yAxisLabelWidth to be set to 0 #321

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/BarChart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ export const BarChart = (props: PropTypes) => {
const yAxisLabelContainerStyle = props.yAxisLabelContainerStyle;
const horizontalRulesStyle = props.horizontalRulesStyle;
const showFractionalValues = props.showFractionalValues || false;
const yAxisLabelWidth = props.yAxisLabelWidth || 35;
const yAxisLabelWidth = props.yAxisLabelWidth ?? 35;
const hideYAxisText = props.hideYAxisText || false;

const backgroundColor = props.backgroundColor || 'transparent';
Expand Down
4 changes: 2 additions & 2 deletions src/LineChart/LineChartBicolor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ export const LineChartBicolor = (props: propTypes) => {
? 0
: props.spacing ||
(adjustToWidth
? ((props.width || 200) - initialSpacing) / data.length
? ((props.width || 200) - initialSpacing) / (data.length - 1)
: 60);

const xAxisLength = props.xAxisLength;
Expand Down Expand Up @@ -705,7 +705,7 @@ export const LineChartBicolor = (props: propTypes) => {
const yAxisLabelContainerStyle = props.yAxisLabelContainerStyle;
const horizontalRulesStyle = props.horizontalRulesStyle;
const showFractionalValues = props.showFractionalValues || false;
const yAxisLabelWidth = props.yAxisLabelWidth || 35;
const yAxisLabelWidth = props.yAxisLabelWidth ?? 35;
const hideYAxisText = props.hideYAxisText || false;

const backgroundColor = props.backgroundColor || 'transparent';
Expand Down
4 changes: 2 additions & 2 deletions src/LineChart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ export const LineChart = (props: propTypes) => {
? 0
: props.spacing ||
(adjustToWidth
? ((props.width || 200) - initialSpacing) / data.length
? ((props.width || 200) - initialSpacing) / (data.length - 1)
: 60);

const xAxisLength = props.xAxisLength;
Expand Down Expand Up @@ -1838,7 +1838,7 @@ export const LineChart = (props: propTypes) => {
const yAxisLabelContainerStyle = props.yAxisLabelContainerStyle;
const horizontalRulesStyle = props.horizontalRulesStyle;
const showFractionalValues = props.showFractionalValues || false;
const yAxisLabelWidth = props.yAxisLabelWidth || 35;
const yAxisLabelWidth = props.yAxisLabelWidth ?? 35;
const hideYAxisText = props.hideYAxisText || false;

const backgroundColor = props.backgroundColor || 'transparent';
Expand Down