| 34388 |
tejus.loha |
1 |
<div class="chart-container" id="chart-container" style="position: relative; width:100%">
|
|
|
2 |
<canvas id="barchart" width="auto" height="auto"></canvas>
|
|
|
3 |
</div>
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
<style>
|
|
|
7 |
canvas {
|
| 28430 |
tejbeer |
8 |
-moz-user-select: none;
|
|
|
9 |
-webkit-user-select: none;
|
|
|
10 |
-ms-user-select: none;
|
|
|
11 |
}
|
|
|
12 |
</style>
|
| 34388 |
tejus.loha |
13 |
|
|
|
14 |
<script type="text/javascript">
|
|
|
15 |
|
|
|
16 |
var options = $chartMap;
|
|
|
17 |
var ctx = document.getElementById('barchart').getContext('2d');
|
|
|
18 |
var myChart = new Chart1(ctx, options);
|
|
|
19 |
var fofoId = `$fofoId`;
|
|
|
20 |
var from = `$from`;
|
|
|
21 |
var to = `$to`;
|
|
|
22 |
var quantity_type = `$isQuantity`;
|
|
|
23 |
|
|
|
24 |
console.log("FROM -", from)// 2025-03-01
|
|
|
25 |
console.log("to -", to)//2025-03-25
|
|
|
26 |
|
|
|
27 |
$("#chartForm").val(from);
|
|
|
28 |
$("#chartTo").val(to);
|
|
|
29 |
$("#quantity_type_id").val(quantity_type).trigger('change');
|
|
|
30 |
|
|
|
31 |
|
|
|
32 |
document.getElementById('barchart').onclick = function (evt) {
|
|
|
33 |
var activePoints = myChart.getElementsAtEvent(evt);
|
|
|
34 |
if (activePoints.length > 0) {
|
|
|
35 |
var dataIndex = activePoints[0]._index; // Kaunsa bar click hua
|
|
|
36 |
var brand = options.data.labels[dataIndex]; // Brand Name
|
|
|
37 |
console.log("Clicked label(brand)-:", brand);
|
|
|
38 |
makeModelWiseChart(brand, from, to, fofoId,quantity_type);
|
|
|
39 |
}
|
|
|
40 |
};
|
|
|
41 |
|
| 34426 |
tejus.loha |
42 |
function makeModelWiseChart(brandName, fromDate, toDate, partnerId, quantity_Type) {
|
|
|
43 |
doGetAjaxRequestHandler(`${context}/brandWiseFofoSaleData?from=${fromDate}&to=${toDate}&brand=${brandName}&fofoId=${partnerId}&isQuantity=${quantity_Type}`, function (response) {
|
|
|
44 |
$('#modelChartModal .model_charbar_container').html(response);
|
|
|
45 |
$('#modelChartModal').modal('show');
|
|
|
46 |
});
|
| 34388 |
tejus.loha |
47 |
}
|
|
|
48 |
</script>
|