Skip to content

Commit

Permalink
Merge pull request #125 from PioneerCode/bug-fixes
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
chad-ramos authored May 18, 2018
2 parents c5a46db + c749c1b commit 1c65a08
Show file tree
Hide file tree
Showing 16 changed files with 80 additions and 50 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@

<a name="0.13.3"></a>
# [v0.13.3](https://github.com/PioneerCode/pioneer-charts/releases/tag/0.13.3) (2018-06-18)

### Fix

- Stop chart failure on empty data sets.
- bar-chart
- line-area-chart
- pie-chart
- table
- Fix normalized height of table.
- Responsive concerns in table.

### Features

- Add the ability to enable/disable sticky footer/header independently of each other.

<a name="0.13.1"></a>
# [v0.13.1](https://github.com/PioneerCode/pioneer-charts/releases/tag/0.13.1) (2018-06-16)

Expand Down
2 changes: 1 addition & 1 deletion apps/dev/src/app/pages/test/test.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="row">
<div class="col-sm">
<div class="pc-chart-container">
<pcac-bar-horizontal-chart [config]="pcService.barHorizontalChartSingleConfig"></pcac-bar-horizontal-chart>
<pcac-bar-horizontal-chart [config]="pcService.barHorizontalChartConfig"></pcac-bar-horizontal-chart>
</div>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion apps/dev/src/assets/mock/table.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"height": 200,
"enableSticky": true,
"enableStickyHeader": true,
"enableStickyFooter": true,
"data": [
{
"data": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ <h3>API</h3>
<pc-prism language="javascript" [code]="importCode"></pc-prism>
<pc-base-config>
<tr>
<td>enableSticky</td>
<td>Enable sticky header and footer.</td>
<td>enableStickyHeader</td>
<td>Enable sticky header.</td>
</tr>
<tr>
<td>enableStickyFooter</td>
<td>Enable sticky footer.</td>
</tr>
</pc-base-config>
</div>
Expand Down
3 changes: 2 additions & 1 deletion apps/docs/src/assets/mock/table.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"height": 200,
"enableSticky": true,
"enableStickyHeader": true,
"enableStickyFooter": true,
"data": [
{
"data": [
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const environment = {
production: true,
version: '0.13.2'
version: '0.13.5'
};
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pioneer-charts",
"version": "0.13.2",
"version": "0.13.5",
"scripts": {
"ng": "ng",
"start": "ng serve pioneer-charts-dev",
Expand Down Expand Up @@ -41,7 +41,7 @@
"@angular/cli": "~6.0.0",
"@angular/compiler-cli": "^6.0.0",
"@angular/language-service": "^6.0.0",
"@pioneer-code/pioneer-charts": "^0.13.2",
"@pioneer-code/pioneer-charts": "^0.13.5",
"@ryancavanaugh/prismjs": "^1.4.3-alpha",
"@types/d3": "^5.0.0",
"@types/jasmine": "~2.8.6",
Expand Down
2 changes: 1 addition & 1 deletion projects/pcac/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"type": "git",
"url": "https://github.com/PioneerCode/pioneer-charts"
},
"version": "0.13.2",
"version": "0.13.5",
"license": "MIT",
"peerDependencies": {
"@angular/common": "^6.0.0-rc.0 || ^6.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ export class PcacBarChartHorizontalComponent implements OnChanges {
}

ngOnChanges() {
if (this.config && this.config.data) {
this.buildChart();
}
this.buildChart();
}

buildChart(): void {
this.chartBuilder.buildChart(this.chartElm, this.config);
if (this.config && this.config.data && this.config.data.length > 0) {
this.chartBuilder.buildChart(this.chartElm, this.config);
}
}

/**
Expand All @@ -53,9 +53,7 @@ export class PcacBarChartHorizontalComponent implements OnChanges {
const self = this;
clearTimeout(this.resizeWindowTimeout);
this.resizeWindowTimeout = setTimeout(() => {
if (self.config.data.length > 0) {
self.buildChart();
}
}, 300);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ export class PcacBarVerticalChartComponent implements OnChanges {
}

ngOnChanges() {
if (this.config && this.config.data) {
this.buildChart();
}
this.buildChart();
}

buildChart(): void {
this.chartBuilder.buildChart(this.chartElm, this.config);
if (this.config && this.config.data && this.config.data.length > 0) {
this.chartBuilder.buildChart(this.chartElm, this.config);
}
}

/**
Expand All @@ -53,9 +53,7 @@ export class PcacBarVerticalChartComponent implements OnChanges {
const self = this;
clearTimeout(this.resizeWindowTimeout);
this.resizeWindowTimeout = setTimeout(() => {
if (self.config.data.length > 0) {
self.buildChart();
}
self.buildChart();
}, 300);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ export class PcacLineAreaChartComponent implements OnChanges {
}

ngOnChanges() {
if (this.config && this.config.data) {
this.buildChart();
}
this.buildChart();
}

buildChart(): void {
this.chartBuilder.buildChart(this.chartElm, this.config);
if (this.config && this.config.data && this.config.data.length > 0) {
this.chartBuilder.buildChart(this.chartElm, this.config);
}
}

/**
Expand All @@ -54,9 +54,7 @@ export class PcacLineAreaChartComponent implements OnChanges {
const self = this;
clearTimeout(this.resizeWindowTimeout);
this.resizeWindowTimeout = setTimeout(() => {
if (self.config.data.length > 0) {
self.buildChart();
}
self.buildChart();
}, 300);
}
}
12 changes: 5 additions & 7 deletions projects/pcac/src/lib/pie-chart/pie-chart.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ export class PcacPieChartComponent implements OnChanges {
}

ngOnChanges() {
if (this.config && this.config.data) {
this.buildChart();
}
this.buildChart();
}

buildChart(): void {
this.chartBuilder.buildChart(this.chartElm, this.config);
if (this.config && this.config.data && this.config.data.length > 0) {
this.chartBuilder.buildChart(this.chartElm, this.config);
}
}

/**
Expand All @@ -53,9 +53,7 @@ export class PcacPieChartComponent implements OnChanges {
const self = this;
clearTimeout(this.resizeWindowTimeout);
this.resizeWindowTimeout = setTimeout(() => {
if (self.config.data.length > 0) {
self.buildChart();
}
self.buildChart();
}, 300);
}
}
4 changes: 2 additions & 2 deletions projects/pcac/src/lib/table/table.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</tr>
</tbody>
</table>
<div *ngIf="config?.enableSticky" class="header">
<div *ngIf="config?.enableStickyHeader" class="header">
<table class="pcac-table">
<thead>
<tr>
Expand All @@ -26,7 +26,7 @@
</thead>
</table>
</div>
<div *ngIf="config?.enableSticky" class="footer" #tableFooter>
<div *ngIf="config?.enableStickyFooter && config?.data.length > 0" class="footer" #tableFooter>
<table class="pcac-table">
<tfoot>
<tr>
Expand Down
28 changes: 21 additions & 7 deletions projects/pcac/src/lib/table/table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {
ViewChild,
ChangeDetectorRef,
QueryList,
ViewChildren
ViewChildren,
HostListener
} from '@angular/core';
import { IPcacTableConfig, IPcacTableHeader, PcacTableSortIconsEnum } from './table.model';
import { TableSortService } from './table-sort.service';
Expand All @@ -35,17 +36,18 @@ export class PcacTableComponent implements OnChanges, AfterViewInit {
rowData = [] as IPcacData[];
adjustedHeight = 200;

private resizeWindowTimeout: NodeJS.Timer;

constructor(
private sortService: TableSortService,
private changeDetector: ChangeDetectorRef
) {
}
) { }

ngAfterViewInit() {
this.initTableUi();
// @ngFor rows finished
this.rows.changes.subscribe(t => {
if (this.config.enableSticky) {
if (this.config.enableStickyHeader || this.config.enableStickyFooter) {
this.calculateColumnWidths();
}
});
Expand All @@ -56,9 +58,9 @@ export class PcacTableComponent implements OnChanges, AfterViewInit {
}

private initTableUi() {
if (this.config && this.config.data) {
this.adjustedHeight = this.config.height + 36;
if (this.config.enableSticky) {
if (this.config && this.config.data && this.config.data.length > 0) {
this.adjustedHeight = this.config.height + 28;
if (this.config.enableStickyHeader || this.config.enableStickyFooter) {
this.calculateColumnWidths();
}
this.setHeaders();
Expand Down Expand Up @@ -122,4 +124,16 @@ export class PcacTableComponent implements OnChanges, AfterViewInit {
}
}
}

/**
* Opting against fromEvent due to incompatibility with rxjs 5 => 6
*/
@HostListener('window:resize')
onResize() {
const self = this;
clearTimeout(this.resizeWindowTimeout);
this.resizeWindowTimeout = setTimeout(() => {
self.initTableUi();
}, 300);
}
}
3 changes: 2 additions & 1 deletion projects/pcac/src/lib/table/table.model.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { IPcacChartConfig } from '../core/chart.model';

export interface IPcacTableConfig extends IPcacChartConfig {
enableSticky: boolean;
enableStickyHeader: boolean;
enableStickyFooter: boolean;
}

export interface IPcacTableHeader {
Expand Down

0 comments on commit 1c65a08

Please sign in to comment.