summaryrefslogtreecommitdiff
path: root/addons/website/views/snippets/s_chart.xml
blob: 822531bc38b4d0420839a3aaff2c10b786f8f24a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<template id="s_chart" name="Chart">
    <div class="s_chart" data-type="bar" data-legend-position="top" data-tooltip-display="true" data-stacked="false" data-border-width="2"
            data-data="{
                &quot;labels&quot;:[&quot;First&quot;,&quot;Second&quot;,&quot;Third&quot;,&quot;Fourth&quot;,&quot;Fifth&quot;],
                &quot;datasets&quot;:[
                    {
                        &quot;label&quot;:&quot;One&quot;,
                        &quot;data&quot;:[&quot;12&quot;,&quot;24&quot;,&quot;18&quot;,&quot;17&quot;,&quot;10&quot;],
                        &quot;backgroundColor&quot;:&quot;o-color-1&quot;,
                        &quot;borderColor&quot;:&quot;o-color-1&quot;
                    }
                ]
            }">
        <h2>A Chart Title</h2>
        <canvas/>
    </div>
</template>

<template id="s_chart_options" inherit_id="website.snippet_options">
    <xpath expr="." position="inside">
        <div data-js="InnerChart" string="Chart"
            data-selector=".s_chart">
            <we-row string="Background">
                <t t-call="web_editor.snippet_options_background_color_widget"/>
            </we-row>
            <we-select string="Type" data-attribute-name="type" data-attribute-default-value="bar">
                <we-button data-select-data-attribute="bar" data-name="bar_chart_opt">Bar Vertical</we-button>
                <we-button data-select-data-attribute="horizontalBar" data-name="horizontal_bar_chart_opt">Bar Horizontal</we-button>
                <we-button data-select-data-attribute="line">Line</we-button>
                <we-button data-select-data-attribute="pie">Pie</we-button>
                <we-button data-select-data-attribute="doughnut">Doughnut</we-button>
                <we-button data-select-data-attribute="radar">Radar</we-button>
            </we-select>
            <we-checkbox string="Stacked" data-name="stacked_chart_opt" data-dependencies="bar_chart_opt, horizontal_bar_chart_opt"
                        data-select-data-attribute="false|true" data-attribute-name="stacked" data-no-preview="true"/>
            <we-select string="Legend" data-attribute-name="legendPosition" data-attribute-default-value="top">
                <we-button data-select-data-attribute="none">None</we-button>
                <we-button data-select-data-attribute="top">Top</we-button>
                <we-button data-select-data-attribute="left">Left</we-button>
                <we-button data-select-data-attribute="bottom">Bottom</we-button>
                <we-button data-select-data-attribute="right">Right</we-button>
            </we-select>
            <we-checkbox string="Tooltip" data-select-data-attribute="false|true" data-attribute-name="tooltipDisplay" data-no-preview="true"/>
            <we-matrix>
                <table>
                    <tr>
                        <th/>
                        <th><we-button class="add_column fa fa-fw fa-plus o_we_link o_we_text_success d-inline-block"/></th>
                    </tr>
                    <tr>
                        <th><we-button class="add_row fa fa-fw fa-plus o_we_link o_we_text_success d-inline-block"/></th>
                    </tr>
                </table>
            </we-matrix>
            <we-colorpicker string="Background" data-name="chart_bg_color_opt"
                data-color-change=""
                data-attribute-name="backgroundColor"
                data-no-preview="true"/>
            <we-colorpicker string="Border" data-name="chart_border_color_opt"
                data-color-change=""
                data-attribute-name="borderColor"
                data-no-preview="true"/>
            <we-input string="Border Width" data-select-data-attribute="2px" data-attribute-name="borderWidth" data-unit="px"/>
        </div>
    </xpath>
</template>

<template id="assets_snippet_s_chart_js_000" inherit_id="website.assets_frontend">
    <xpath expr="//script[last()]" position="after">
        <script type="text/javascript" src="/website/static/src/snippets/s_chart/000.js"/>
    </xpath>
</template>

</odoo>