0

Regarding issues with editing the chart code

Hello everyone! Through studying the dashboard template Dashboard Template  shared by Sotirios Zormpas, I have learned chart code. The following code already implements the display of accumulated data for a specific month. However, I still want to improve this feature. Thanks for your help! Thanks in advance.

 

  • The time displayed in the chart does not show the complete days of the month, and I have set the code as follows(At the bottom.)..However, the view did not display correctly. Could you please tell me where the issue might be?  
let fullDates := for i in range(1, 31) do
        if i < 10 then "0" + text(i) else text(i) end
    end;
let Timeperiod := (select 'Orders')[month(date('data')) = 5];
let onlytime := unique(Timeperiod.'data');
let cumulative := 0;
let AAAAAA := for luo1 in fullDates do
····

 

  • I want to compare the cumulative data for April. How can I display them in a single chart? How should the code be adjusted?

let Timeperiod := (select 'Orders')[month(date('data')) = 5];
let onlytime := unique(Timeperiod.'data');
let cumulative := 0;
let AAAAAA := for luo1 in onlytime do
        let Datadata := sum(Timeperiod['data' = luo1].'money');
        cumulative := cumulative + Datadata;
        {
            name: luo1,
            cumulative: cumulative
        }
    end;
let chartOptions04 := {
        title: {
            text: ""
        },
        tooltip: {
            trigger: "axis"
        },
        legend: {
            top: "name"
        },
        grid: {
            left: "3%",
            right: "4%",
            bottom: "3%",
            containLabel: true
        },
        dataset: [{
                source: AAAAAA
            }],
        xAxis: {
            type: "category",
            encode: {
                x: "name"
            }
        },
        yAxis: {
            type: "value",
            axisLabel: {
                interval: 0
            }
        },
        series: [{
                name: "name",
                type: "line",
                smooth: true,
                seriesLayoutBy: "row",
                stack: "total",
                label: {
                    show: false
                },
                emphasis: {
                    focus: "series"
                },
                encode: {
                    x: "name",
                    y: "cumulative"
                }
            }]
    };

Reply

null

Content aside

  • yesterdayLast active
  • 11Views
  • 1 Following