Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
3935 มุมมอง

Hi Guys, i have used canvas for plotting pie chart in Report.

So if I am seeing it as qweb-html, its rendering correctly.



But in PDF it not loading:



In PDF it's not rendering.

Any idea, how can i get this pie chart in my PDF.

Code:

<div class="page">
<script type="text/javascript">
window.onload = function() {
var chart = new CanvasJS.Chart("chartContainer", {
animationEnabled: true,
title: {
text: "Desktop Search Engine Market Share - 2016"
},
data: [{
type: "pie",
startAngle: 240,
yValueFormatString: "##0.00\"%\"",
indexLabel: "{label} {y}",
dataPoints: [
{y: 79.45, label: "Google"},
{y: 7.31, label: "Bing"},
{y: 7.06, label: "Baidu"},
{y: 4.91, label: "Yahoo"},
{y: 1.26, label: "Others"}
]
}]
});
chart.render();
}
</script>
<div id="chartContainer" style="height: 300px; width: 100%;"></div>
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Javascript not working in qweb pdf, you need to do it outside qweb in python function

Thanks

อวตาร
ละทิ้ง
ผู้เขียน

Do you have seen this type of thing anywhere in odoo?

ผู้เขียน

Any Example

Unfortunately, I don't have an example because it is complicated to do it. You need to combine python with javascript and qweb

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
พ.ย. 24
1139
PDF reports แก้ไขแล้ว
5
ก.ค. 25
2247
Wrong PDF Format แก้ไขแล้ว
2
มี.ค. 24
2761
0
พ.ย. 22
2983
0
ก.ย. 17
5289