frappe / charts

Simple, responsive, modern SVG Charts with zero dependencies
https://frappe.io/charts
MIT License
14.9k stars 716 forks source link

feat: initial radar chart #413

Open casesolved-co-uk opened 1 year ago

casesolved-co-uk commented 1 year ago

Basic implementation of polar radar charts Satisfies #151

Needs documentation, where do I put that?

fix: first rendering version without axis feat: radial axis working but buggy, and tidy feat: radar theta axis fix: radar bugs and tidy fix: missing state variable

Explanation About What Code Achieves:
Screenshots/GIFs:

Screen Shot 2023-05-18 at 22 06 33

Steps To Test:
let radar_data = {
    labels: [
        "Marketing & Communication",
        "Financial",
        "Technology",
        "Green Agenda",
        "Workforce Planning",
        "General Advice"
    ],

    datasets: [
        {
            name: "Before",
            values: [4, 6, 8, 7, 3, 5]
        },
        {
            name: "After",
            values: [5, 7, 6, 3, 4, 6]
        }
    ]
};

function render_radar() {
    new frappe.Chart("#chart-radar", {
        title: "Business Assessment",
        height: 400,
        colors: ["purple", "light-blue"],
        data: radar_data,
        type: 'radar',
        tooltipOptions: {
            formatTooltipX: (d) => (d + "").toUpperCase(),
            formatTooltipY: (d) => d + " pts"
        }
    });
}
TODOs: