@oliasoft-open-source/charts-library 2.16.0-beta-5 → 2.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/charts-library",
3
- "version": "2.16.0-beta-5",
3
+ "version": "2.16.0",
4
4
  "description": "React Chart Library (based on Chart.js and react-chart-js-2)",
5
5
  "homepage": "https://gitlab.com/oliasoft-open-source/charts-library",
6
6
  "bugs": {
@@ -50,6 +50,7 @@ export const useChartOptions = ({
50
50
  lineHeight,
51
51
  },
52
52
  },
53
+ chartStyling: { layoutPadding },
53
54
  } = options;
54
55
 
55
56
  const {
@@ -149,6 +150,9 @@ export const useChartOptions = ({
149
150
 
150
151
  return useMemo(
151
152
  () => ({
153
+ layout: {
154
+ padding: layoutPadding,
155
+ },
152
156
  onHover: onHover(hoveredPoint, setHoveredPoint),
153
157
  maintainAspectRatio: options.chartStyling.maintainAspectRatio,
154
158
  aspectRatio: options.chartStyling.squareAspectRatio ? 1 : null,
@@ -60,6 +60,15 @@ export const LineChartPropTypes = {
60
60
  staticChartHeight: PropTypes.bool,
61
61
  performanceMode: PropTypes.bool,
62
62
  squareAspectRatio: PropTypes.bool,
63
+ layoutPadding: PropTypes.oneOfType([
64
+ PropTypes.number,
65
+ PropTypes.shape({
66
+ top: PropTypes.number,
67
+ bottom: PropTypes.number,
68
+ left: PropTypes.number,
69
+ right: PropTypes.number,
70
+ }),
71
+ ]),
63
72
  }),
64
73
  tooltip: PropTypes.shape({
65
74
  tooltips: PropTypes.bool,
@@ -198,6 +207,12 @@ export const getDefaultProps = (props) => {
198
207
  props.chart.options.chartStyling.performanceMode ?? true,
199
208
  squareAspectRatio:
200
209
  props.chart.options.chartStyling.squareAspectRatio || false,
210
+ layoutPadding: props.chart.options.chartStyling.layoutPadding || {
211
+ top: 0,
212
+ bottom: 20,
213
+ left: 0,
214
+ right: 0,
215
+ },
201
216
  },
202
217
  tooltip: {
203
218
  tooltips: props.chart.options.tooltip.tooltips ?? true,