@carnallfarrar/cf-react-chart-library
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -17,2 +17,4 @@ import React from "react"; | ||
data?: DataPoint[]; | ||
xLabel: string; | ||
yLabel: string; | ||
} | ||
@@ -19,0 +21,0 @@ export declare const BarChart: React.FC<BarsGroupProps>; |
@@ -29,6 +29,6 @@ "use strict"; | ||
var getWeek = function (d) { return d.xLabel; }; | ||
var defaultMargin = { top: 50, right: 0, bottom: 20, left: 40 }; | ||
var defaultMargin = { top: 50, right: 0, bottom: 60, left: 80 }; | ||
var tooltipTimeout; | ||
var BarChart = function (_a) { | ||
var width = _a.width, height = _a.height, _b = _a.margin, margin = _b === void 0 ? defaultMargin : _b, data = _a.data; | ||
var width = _a.width, height = _a.height, _b = _a.margin, margin = _b === void 0 ? defaultMargin : _b, xLabel = _a.xLabel, yLabel = _a.yLabel, data = _a.data; | ||
var theme = (0, styles_1.useTheme)(); | ||
@@ -47,3 +47,3 @@ var tooltipStyles = __assign(__assign({}, tooltip_1.defaultStyles), { padding: "10px 20px", backgroundColor: theme.palette.primary.dark, color: "white" }); | ||
} | ||
var keys = Object.keys(data[0]).filter(function (i) { return i !== "week"; }); | ||
var keys = Object.keys(data[0]).filter(function (i) { return i !== "xLabel"; }); | ||
var seriesScale = (0, scale_1.scaleBand)({ | ||
@@ -79,4 +79,18 @@ domain: keys, | ||
textAnchor: "end", | ||
}); } }), | ||
react_1.default.createElement(axis_1.AxisBottom, { top: yMax + margin.top, left: margin.left, scale: weekScale, stroke: theme.palette.primary.dark, tickStroke: theme.palette.primary.dark, tickLabelProps: function () { return ({ | ||
}); }, label: yLabel, labelProps: { | ||
x: -(yMax / 2), | ||
y: -(margin.left - 20), | ||
textAnchor: "middle", | ||
fontSize: 12, | ||
fontWeight: 800, | ||
fill: theme.palette.primary.light, | ||
} }), | ||
react_1.default.createElement(axis_1.AxisBottom, { top: yMax + margin.top, left: margin.left, scale: weekScale, stroke: theme.palette.primary.dark, tickStroke: theme.palette.primary.dark, label: xLabel, labelProps: { | ||
x: xMax / 2, | ||
y: margin.bottom - 20, | ||
textAnchor: "middle", | ||
fontSize: 12, | ||
fontWeight: 800, | ||
fill: theme.palette.primary.light, | ||
}, tickLabelProps: function () { return ({ | ||
fill: theme.palette.primary.dark, | ||
@@ -83,0 +97,0 @@ fontSize: 11, |
{ | ||
"name": "@carnallfarrar/cf-react-chart-library", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A React Chart library on top of Airbnb Visx", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
21424
364