Merge pull request #31912 from sokumon/charts-label

fix: make x-axis label take less space
This commit is contained in:
Soham Kulkarni 2025-03-31 17:49:22 +05:30 committed by GitHub
commit fd783f07de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 7 deletions

View file

@ -1237,7 +1237,7 @@ Object.assign(frappe.utils, {
chart_args[key] = custom_options[key];
}
}
frappe.utils.set_space_label_ratio(chart_args);
return new frappe.Chart(wrapper, chart_args);
},
@ -1245,7 +1245,11 @@ Object.assign(frappe.utils, {
const default_country = frappe.sys_defaults.country;
return frappe.utils.shorten_number(label, country || default_country, 3);
},
set_space_label_ratio(chart_args) {
if (chart_args.data.labels.length > 10) {
chart_args["axisOptions"]["seriesLabelSpaceRatio"] = 0.9;
}
},
generate_route(item) {
const type = item.type.toLowerCase();
if (type === "doctype") {

View file

@ -51,7 +51,7 @@
"esbuild-plugin-vue3": "^0.3.0",
"fast-deep-equal": "^2.0.1",
"fast-glob": "^3.2.5",
"frappe-charts": "2.0.0-rc22",
"frappe-charts": "^2.0.0-rc26",
"frappe-datatable": "1.18.1",
"frappe-gantt": "^0.6.0",
"highlight.js": "^10.4.1",

View file

@ -1485,10 +1485,10 @@ fraction.js@^4.3.6:
resolved "https://registry.yarnpkg.com/fraction.js/-/fraction.js-4.3.7.tgz#06ca0085157e42fda7f9e726e79fefc4068840f7"
integrity sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==
frappe-charts@2.0.0-rc22:
version "2.0.0-rc22"
resolved "https://registry.yarnpkg.com/frappe-charts/-/frappe-charts-2.0.0-rc22.tgz#9a5a747febdc381a1d4d7af96e89cf519dfba8c0"
integrity sha512-N7f/8979wJCKjusOinaUYfMxB80YnfuVLrSkjpj4LtyqS0BGS6SuJxUnb7Jl4RWUFEIs7zEhideIKnyLeFZF4Q==
frappe-charts@^2.0.0-rc26:
version "2.0.0-rc26"
resolved "https://registry.yarnpkg.com/frappe-charts/-/frappe-charts-2.0.0-rc26.tgz#9632d620b92f2043cebd192a8899119f5715524b"
integrity sha512-0vyXcwcekIeYA6pxCHGcRdG8llC6hpGR91nkbwRGSnBYMKomX2AQtfgTlIKMrE9nmAkewJeZsTx1scni8Ry0iA==
frappe-datatable@1.18.1:
version "1.18.1"