Skip to content

Commit 5a74c05

Browse files
authored
Merge pull request #34 from theiliad/master
fix(core angular): IE11 Support & Update README with NPM version & build status
2 parents 52923dc + 2700223 commit 5a74c05

12 files changed

+72
-13
lines changed

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
<h3 align="center">Carbon Charts</h3>
66
<p align="center">
77
A reusable framework-agnostic D3 charting library.
8+
<br /><br />
9+
<a href="https://travis-ci.org/IBM/carbon-charts/">
10+
<img src="https://api.travis-ci.org/IBM/carbon-charts.svg?branch=master" />
11+
</a>
12+
<a href="https://www.npmjs.com/package/@carbon/charts">
13+
<img src="https://img.shields.io/npm/v/@carbon/charts.svg" />
14+
</a>
15+
<img src="https://img.shields.io/badge/comp-IE11%2B-blue.svg" />
816
</p>
917
<p align="center">
1018
:bar_chart: :chart_with_upwards_trend: :rocket:

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"scripts": {
1414
"commit": "git-cz",
1515
"postinstall": "lerna bootstrap",
16+
"pre-push": "lerna run lint",
1617
"test": "lerna run test",
1718
"lint": "eslint packages"
1819
},

packages/angular/src/charts.module.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import { BarChartComponent } from "./bar-chart.component";
77
import { LineChartComponent } from "./line-chart.component";
88

99
@NgModule({
10-
imports: [CommonModule],
10+
imports: [
11+
CommonModule
12+
],
1113
declarations: [
1214
DonutChartComponent,
1315
PieChartComponent,

packages/core/package-lock.json

+36-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"@types/d3": "4.11.0",
3030
"@types/jasmine": "2.8.7",
3131
"@types/node": "10.0.8",
32+
"babel-polyfill": "6.26.0",
3233
"css-loader": "0.28.7",
3334
"extract-text-webpack-plugin": "3.0.2",
3435
"file-loader": "1.1.5",

packages/core/src/bar-chart.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class BarChart extends BaseAxisChart {
9595
this.updateOverlay().hide();
9696

9797
// Dispatch the load event
98-
this.events.dispatchEvent(new Event("load"));
98+
this.dispatchEvent("load");
9999
}
100100

101101
interpolateValues(newData: any) {
@@ -173,7 +173,7 @@ export class BarChart extends BaseAxisChart {
173173
this.updateOverlay().hide();
174174

175175
// Dispatch the update event
176-
this.events.dispatchEvent(new Event("update"));
176+
this.dispatchEvent("update");
177177
}
178178

179179
updateElements(animate: boolean, rect?: any, g?: any) {

packages/core/src/base-axis-chart.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export class BaseAxisChart extends BaseChart {
153153
this.repositionXAxisTitle();
154154
}
155155

156-
this.events.dispatchEvent(new Event("resize"));
156+
this.dispatchEvent("resize");
157157
}
158158

159159
/**************************************

packages/core/src/base-chart.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ export class BaseChart {
5757
}
5858
}
5959

60+
dispatchEvent(eventType: string) {
61+
const event = document.createEvent("Event");
62+
event.initEvent(eventType, false, true);
63+
64+
this.events.dispatchEvent(event);
65+
}
6066

6167
setData(data: any) {
6268
const { selectors } = Configuration;
@@ -65,7 +71,7 @@ export class BaseChart {
6571
const newDataIsAPromise = Promise.resolve(data) === data;
6672

6773
// Dispatch the update event
68-
this.events.dispatchEvent(new Event("data-change"));
74+
this.dispatchEvent("data-change");
6975

7076
if (initialDraw || newDataIsAPromise) {
7177
this.updateOverlay().show();
@@ -78,7 +84,7 @@ export class BaseChart {
7884

7985
Promise.resolve(data).then(value => {
8086
// Dispatch the update event
81-
this.events.dispatchEvent(new Event("data-load"));
87+
this.dispatchEvent("data-load");
8288

8389
// Process data
8490
// this.data = this.dataProcessor(Tools.clone(value));

packages/core/src/line-chart.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class LineChart extends BaseAxisChart {
8080
this.updateOverlay().hide();
8181

8282
// Dispatch the load event
83-
this.events.dispatchEvent(new Event("load"));
83+
this.dispatchEvent("load");
8484
}
8585

8686
interpolateValues(newData: any) {
@@ -136,7 +136,7 @@ export class LineChart extends BaseAxisChart {
136136
this.updateOverlay().hide();
137137

138138
// Dispatch the update event
139-
this.events.dispatchEvent(new Event("update"));
139+
this.dispatchEvent("update");
140140
}
141141

142142
updateElements(animate: boolean, gLines?: any) {

packages/core/src/stacked-bar-chart.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export class StackedBarChart extends BaseAxisChart {
100100
this.updateOverlay().hide();
101101

102102
// Dispatch the load event
103-
this.events.dispatchEvent(new Event("load"));
103+
this.dispatchEvent("load");
104104
}
105105

106106
interpolateValues(newData: any) {
@@ -159,7 +159,7 @@ export class StackedBarChart extends BaseAxisChart {
159159
this.updateOverlay().hide();
160160

161161
// Dispatch the update event
162-
this.events.dispatchEvent(new Event("update"));
162+
this.dispatchEvent("update");
163163
}
164164

165165
resizeChart() {

packages/core/webpack.build.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ function rxjsExternal(context, request, cb) {
1717
module.exports = [{
1818
devtool: "source-map",
1919
entry: {
20-
charts: "./src/index.ts"
20+
charts: [
21+
"babel-polyfill",
22+
"./src/index.ts"
23+
]
2124
},
2225
output: {
2326
path: __dirname + '/dist/bundle',

packages/core/webpack.config.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ var HtmlWebpackPlugin = require('html-webpack-plugin');
22

33
module.exports = {
44
devtool: "sourcemap",
5-
entry: "./demo/index.ts",
5+
entry: [
6+
"babel-polyfill",
7+
"./demo/index.ts"
8+
],
69
output: {
710
path: __dirname + '/demo/bundle',
811
filename: "bundle.js",

0 commit comments

Comments
 (0)