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.

Make Chart Margins and Padding Optional/Adjustable

See original GitHub issue

Is your feature request related to a problem? Please describe.

We have removed the left axis labels, but can’t left-align the chart because the entire element has been translated:

<g class="apexcharts-inner apexcharts-graphical" transform="translate(20, 30)">

screen shot 2018-10-28 at 1 11 05 pm

  • Red Line: This is the left SVG bound, where we would like to align the chart.
  • Green Line: This is where the chart begins because of the translate. Margin should be optional
  • Blue Line: This is where the series data starts, this data should also be optional
  • Orange Lines: The same data padding on the right side should be optional

Describe the solution you’d like

Give options to remove/adjust these margins/padding (currently the only way is to use Sparklines, but this limits other options)

Describe alternatives you’ve considered

Forking repo; manual/external CSS overrides; masking with external elements; etc

Additional context

n/a

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:10
  • Comments:28 (6 by maintainers)

github_iconTop GitHub Comments

34reactions
junedchhipacommented, Nov 3, 2018

@benhaynes The way to remove all paddings/margins would be

  1. hide the y-axis by yaxis.show = false
  2. Remove the default grid paddings
grid: {
  padding: {
    left: 0,
    right: 0
  }
}

This should remove all unnecessary spacings. Let me know if the above settings worked.

This update is available in v2.2.0

13reactions
inodacommented, Oct 12, 2019

Is there a way to keep the y-axis labels but still remove the extra padding on the left? It’s unideal that the only way to get rid of it is by removing helpful labeling.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Padding - Chart.js
Let's say you wanted to add 50px of padding to the left side of the chart canvas, you would do: let chart =...
Read more >
Chart.js adds unwanted padding on top and below chart with ...
I think if you give the parent-div of your chart the wanted 180x180pixels, you can add to your options chartArea: { width: '100%',...
Read more >
How To Add A Margin Between The Chart Area And The Chart Line
Chart margin is the space between the chart border and the canvas border. For a line/area chart canvas padding is the space between...
Read more >
Chart Paddings and Margins - FusionCharts
Chart margin is the space between the chart border and the canvas border. You can set the chart margins on any one of...
Read more >
How to Adjust the Width or Height of Chart Margins on an Excel
Surrounding an excel chart is a border, which may be called the "border of the chart ... Drag these handles to make the...
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