Skip to content

Commit 1887f1f

Browse files
committed
up
1 parent dbfcd29 commit 1887f1f

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

grid/sidepanel/src/app/app.component.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ <h3>Product Details</h3>
1414
<p><strong>Product:</strong> {{ selectedRow.product }}</p>
1515
<p><strong>Quantity:</strong> {{ selectedRow.quantity }}</p>
1616
<p><strong>Price:</strong> {{ selectedRow.price }} €</p>
17-
<p><strong>Total:</strong> {{ selectedRow.total }} €</p>
17+
<p><strong>Total:</strong> {{ selectedRow.total }} €</p>
1818

1919
<jqxGauge
20+
id="quantityGauge"
2021
[ranges]="gaugeRanges"
2122
[value]="selectedRow.quantity"
2223
[width]="200"
@@ -28,6 +29,7 @@ <h3>Product Details</h3>
2829
></jqxGauge>
2930

3031
<jqxChart
32+
id="priceChart"
3133
[title]="'Price Trend'"
3234
[source]="chartData"
3335
[xAxis]="chartXAxis"

grid/sidepanel/src/app/app.component.ts

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { jqxGridModule, jqxGridComponent } from 'jqwidgets-ng/jqxgrid';
44
import { jqxGaugeModule } from 'jqwidgets-ng/jqxgauge';
55
import { jqxChartModule } from 'jqwidgets-ng/jqxchart';
6+
declare var JQXLite: any; // Declare it here globally for TypeScript
67

78
@Component({
89
selector: 'app-root',
@@ -130,13 +131,37 @@ export class AppComponent {
130131
onRowSelect(event: any): void {
131132
const row = event.args.row;
132133
this.selectedRow = row;
133-
134+
this.selectedRow.total = this.selectedRow.quantity * this.selectedRow.price;
134135
// Generate mock chart data for demonstration
135136
this.chartData = Array.from({ length: 5 }, (_, i) => ({
136137
label: `Week ${i + 1}`,
137138
value: +(Math.random() * 5 + 1).toFixed(2),
138139
}));
139140

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+
});
141166
}
142167
}

0 commit comments

Comments
 (0)