Skip to content

Instantly share code, notes, and snippets.

@sehrishnaz
Created November 19, 2020 08:19
Show Gist options
  • Save sehrishnaz/fda06fb60348c953f83f7ebf8733a3a1 to your computer and use it in GitHub Desktop.
Save sehrishnaz/fda06fb60348c953f83f7ebf8733a3a1 to your computer and use it in GitHub Desktop.
Odoo Web Controller XML
<openerp>
<data>
<template id="graph_template">
<t t-call="website.layout">
<head>
<title>Graph Web Controller Example</title>
</head>
<body>
<div class="container">
<div class="page">
<div class="row">
<canvas id="line-chart" width="200" height="50"></canvas>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js"></script>
<script>
var x_axis = <t t-esc="x_axis"/>;
var y_axis = <t t-esc="y_axis"/>;
new Chart(document.getElementById("line-chart"), {
type: 'line',
data: {
labels: x_axis,
datasets: [{
data: y_axis,
label: "Actual Curve",
borderColor: "#3e95cd",
fill: false
}
]
},
options: {
title: {
display: false,
text: 'World population per region (in millions)'
}
}
});
</script>
</body>
</t>
</template>
</data>
</openerp>
@sehrishnaz
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment