Skip to content
Open
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ node_modules/
.expo/
.DS_Store
npm-debug.*
package-lock.json
.idea
.vscode
yarn.lock
dist
dist
lib
29 changes: 23 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,29 @@
"pretty-quick": "^1.11.1",
"react": "16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz",
"react-native-builder-bob": "0.17.1",
"react-native-flash-message": "^0.1.10",
"react-native-scrollable-tab-view": "^1.0.0",
"react-native-svg": "11.0.1",
"react-test-renderer": "16.7.0",
"typescript": "^3.9.5"
},
"_main": "./node_modules/expo/AppEntry.js",
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
"main": "lib/commonjs/index.js",
"source": "src/index.ts",
"react-native": "src/index.ts",
"module": "lib/module/index.js",
"types": "lib/typescript/index.d.ts",
"files": [
"dist"
"src",
"lib"
],
"scripts": {
"start": "expo start",
"eject": "expo eject",
"android": "expo start --android",
"ios": "expo start --ios",
"test": "jest",
"build": "tsc",
"dev": "tsc --watch",
"build": "bob build",
"prepublish": "yarn build",
"prepare": "yarn build"
},
Expand Down Expand Up @@ -69,5 +72,19 @@
},
"resolutions": {
"@types/react": "16.14.8"
},
"react-native-builder-bob": {
"source": "src",
"output": "lib",
"targets": [
"commonjs",
"module",
[
"typescript",
{
"project": "tsconfig.json"
}
]
]
}
}
46 changes: 24 additions & 22 deletions src/StackedBarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,31 +120,33 @@ class StackedBarChart extends AbstractChart<
barWidth / 2) *
fac;

ret.push(
<Rect
key={Math.random()}
x={xC}
y={y}
rx={this.getBarRadius(ret, x)}
ry={this.getBarRadius(ret, x)}
width={barWidth}
height={h}
fill={colors[z]}
/>
);

if (!this.props.hideLegend) {
if (x[z] > 0) {
ret.push(
<Text
<Rect
key={Math.random()}
x={xC + 7 + barWidth / 2}
textAnchor="end"
y={h > 15 ? y + 15 : y + 7}
{...this.getPropsForLabels()}
>
{x[z]}
</Text>
x={xC}
y={y}
rx={this.getBarRadius(ret, x)}
ry={this.getBarRadius(ret, x)}
width={barWidth}
height={h}
fill={colors[z]}
/>
);

if (!this.props.hideLegend) {
ret.push(
<Text
key={Math.random()}
x={xC + 4 + barWidth / 2}
textAnchor="end"
y={h > 15 ? y + 15 : y + 7}
{...this.getPropsForLabels()}
>
{x[z]}
</Text>
);
}
}

st -= h;
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"module": "esnext",
"moduleResolution": "node",
"rootDir": "./src",
"outDir": "./dist",
"declaration": true,
"declarationMap": true,
"inlineSourceMap": true,
Expand Down
Loading