功能: 完善功率曲线报告导出与图表样式
This commit is contained in:
@@ -259,7 +259,7 @@ bool ValidateChartOptions(const json& options, std::string& error) {
|
||||
};
|
||||
if (!validate_number("scatter_size", 1.0, 8.0) ||
|
||||
!validate_number("scatter_opacity", 0.0, 100.0) ||
|
||||
!validate_number("text_size", 10.0, 24.0) ||
|
||||
!validate_number("text_scale", 0.75, 1.5) ||
|
||||
!validate_number("actual_marker_size", 2.0, 12.0) ||
|
||||
!validate_number("design_marker_size", 2.0, 12.0)) {
|
||||
error = "图表数值参数无效";
|
||||
@@ -311,6 +311,15 @@ std::optional<json> LoadChartOptions() {
|
||||
if (!options.contains("show_filtered")) {
|
||||
options["show_filtered"] = false;
|
||||
}
|
||||
// Migrate the earlier single pixel-size setting to the shared text multiplier.
|
||||
if (!options.contains("text_scale")) {
|
||||
double scale = 1.0;
|
||||
if (options.contains("text_size") && options["text_size"].is_number()) {
|
||||
scale = options["text_size"].get<double>() / 18.0;
|
||||
}
|
||||
options["text_scale"] = std::clamp(scale, 0.75, 1.5);
|
||||
}
|
||||
options.erase("text_size");
|
||||
std::string error;
|
||||
if (ValidateChartOptions(options, error)) {
|
||||
return std::optional<json>{options};
|
||||
|
||||
Reference in New Issue
Block a user