|
3 | 3 | import { jqxGridModule, jqxGridComponent } from 'jqwidgets-ng/jqxgrid';
|
4 | 4 | import { jqxGaugeModule } from 'jqwidgets-ng/jqxgauge';
|
5 | 5 | import { jqxChartModule } from 'jqwidgets-ng/jqxchart';
|
| 6 | +declare var JQXLite: any; // Declare it here globally for TypeScript |
6 | 7 |
|
7 | 8 | @Component({
|
8 | 9 | selector: 'app-root',
|
@@ -130,13 +131,37 @@ export class AppComponent {
|
130 | 131 | onRowSelect(event: any): void {
|
131 | 132 | const row = event.args.row;
|
132 | 133 | this.selectedRow = row;
|
133 |
| - |
| 134 | + this.selectedRow.total = this.selectedRow.quantity * this.selectedRow.price; |
134 | 135 | // Generate mock chart data for demonstration
|
135 | 136 | this.chartData = Array.from({ length: 5 }, (_, i) => ({
|
136 | 137 | label: `Week ${i + 1}`,
|
137 | 138 | value: +(Math.random() * 5 + 1).toFixed(2),
|
138 | 139 | }));
|
139 | 140 |
|
140 |
| - this.myGrid.showSidePanel(document.querySelector("#sidePanel"), 400); |
| 141 | + const sidePanel: HTMLElement = document.querySelector( |
| 142 | + '#sidePanel' |
| 143 | + ) as HTMLElement; |
| 144 | + |
| 145 | + this.myGrid.showSidePanel(sidePanel, 400, (panel) => { |
| 146 | + panel = JQXLite(panel); |
| 147 | + panel.find("#productName").text(row.product); |
| 148 | + panel.find("#productQty").text(row.quantity); |
| 149 | + panel.find("#productPrice").text(row.price.toFixed(2) + ' €'); |
| 150 | + panel.find("#productTotal").text((row.quantity * row.price).toFixed(2) + ' €'); |
| 151 | + // Gauge |
| 152 | + panel.find("#quantityGauge").jqxGauge({ |
| 153 | + ranges: [{ startValue: 0, endValue: 3, style: { fill: '#4bb648', stroke: '#4bb648' }, endWidth: 5, startWidth: 1 }, |
| 154 | + { startValue: 3, endValue: 5, style: { fill: '#fbd109', stroke: '#fbd109' }, endWidth: 10, startWidth: 5 }, |
| 155 | + { startValue: 5, endValue: 7, style: { fill: '#ff8000', stroke: '#ff8000' }, endWidth: 13, startWidth: 10 }, |
| 156 | + { startValue: 7, endValue: 10, style: { fill: '#e02629', stroke: '#e02629' }, endWidth: 16, startWidth: 13 }], |
| 157 | + colorScheme: 'scheme05', |
| 158 | + width: 200, |
| 159 | + height: 200, |
| 160 | + animationDuration: 1200, |
| 161 | + max: 10, |
| 162 | + niceInterval: true, |
| 163 | + value: row.quantity |
| 164 | + }); |
| 165 | + }); |
141 | 166 | }
|
142 | 167 | }
|
0 commit comments