Skip to content

Commit c08844c

Browse files
committed
Review
1 parent d166817 commit c08844c

File tree

9 files changed

+14
-24
lines changed

9 files changed

+14
-24
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
- Legend title bottomPadding extended.
88
- ColorGradient fromString not increasing position prohibited.
9-
- Remove background settings for all text, including title, subtitle and caption.
109
- Fix alpha settings to linear by default:
1110
- Axis: line, title, labels, guides, interlacing, ticks
1211
- Legend: title, dimension markers, measure extrema labels
@@ -15,6 +14,7 @@
1514
### Added
1615

1716
- New style parameter for the legend scrolling.
17+
- Remove background settings for all text, including title, subtitle and caption.
1818

1919
## [0.12.1] - 2024-08-22
2020

src/base/gfx/colortransform.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,12 @@ ColorTransform ColorTransform::Lightness(double factor)
6565
}
6666

6767
ColorTransform ColorTransform::Opacity(double factor)
68-
{
69-
return {[=](const Color &color)
70-
{
71-
return color.transparent(factor);
72-
},
73-
"opacity(" + std::to_string(factor) + ")"};
74-
}
75-
76-
ColorTransform ColorTransform::Fade(double factor)
7768
{
7869
return {[=](const Color &color)
7970
{
8071
return color * factor;
8172
},
82-
"fade(" + std::to_string(factor) + ")"};
73+
"opacity(" + std::to_string(factor) + ")"};
8374
}
8475

8576
ColorTransform ColorTransform::None()

src/base/gfx/colortransform.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class ColorTransform
1919
static ColorTransform Grayscale(double factor);
2020
static ColorTransform Lightness(double factor);
2121
static ColorTransform Opacity(double factor);
22-
static ColorTransform Fade(double factor);
2322
static ColorTransform None();
2423

2524
Color operator()(const Color &color) const;

src/base/math/fuzzybool.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class FuzzyBool
124124
return FuzzyBool(std::max(0.0, 1 - 2 * value));
125125
}
126126

127-
[[nodiscard]] FuzzyBool lessAndMore() const
127+
[[nodiscard]] FuzzyBool moreOrLess() const
128128
{
129129
return FuzzyBool(std::abs(2 * value - 1));
130130
}

src/chart/rendering/drawaxes.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ void DrawAxes::drawTitle(Gen::ChannelId axisIndex) const
253253
*rootEvents.draw.plot.axis.title,
254254
Events::Targets::axisTitle(title.value,
255255
axisIndex == Gen::ChannelId::x),
256-
{.colorTransform = Gfx::ColorTransform::Fade(weight),
256+
{.colorTransform = Gfx::ColorTransform::Opacity(weight),
257257
.flip = upsideDown});
258258

259259
canvas.restore();
@@ -354,7 +354,7 @@ void DrawAxes::drawDimensionLabel(bool horizontal,
354354
posDir,
355355
labelStyle,
356356
0,
357-
Gfx::ColorTransform::Fade(
357+
Gfx::ColorTransform::Opacity(
358358
Math::FuzzyBool::And(weight,
359359
str.weight,
360360
plusWeight)),

src/chart/rendering/drawchart.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ void DrawChart::drawHeading(Gfx::ICanvas &canvas,
7575
style,
7676
event,
7777
targetGetter(*weighted.value),
78-
{.colorTransform = Gfx::ColorTransform::Fade(
79-
Math::FuzzyBool::more(
80-
weighted.weight))});
78+
{.colorTransform =
79+
Gfx::ColorTransform::Opacity(
80+
Math::FuzzyBool::more(
81+
weighted.weight))});
8182
}
8283
});
8384
}

src/chart/rendering/drawinterlacing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ void DrawInterlacing::drawDataLabel(
288288
posDir,
289289
labelStyle,
290290
0,
291-
Gfx::ColorTransform::Fade(Math::FuzzyBool::And(alpha,
291+
Gfx::ColorTransform::Opacity(Math::FuzzyBool::And(alpha,
292292
position.weight,
293293
wUnit.weight)),
294294
*rootEvents.draw.plot.axis.label,

src/chart/rendering/drawlegend.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ void DrawLegend::drawTitle(const Info &info) const
136136
*events.title,
137137
Events::Targets::legendTitle(title.value,
138138
info.properties),
139-
{.colorTransform = Gfx::ColorTransform::Fade(
139+
{.colorTransform = Gfx::ColorTransform::Opacity(
140140
Math::FuzzyBool::And(title.weight,
141141
info.weight,
142142
mul))});
@@ -188,7 +188,7 @@ void DrawLegend::drawDimension(Info &info) const
188188
value.second.categoryValue,
189189
value.second.categoryValue,
190190
info.properties),
191-
{.colorTransform = Gfx::ColorTransform::Fade(
191+
{.colorTransform = Gfx::ColorTransform::Opacity(
192192
Math::FuzzyBool::And(alpha,
193193
weighted.weight)),
194194
.gradient = needGradient
@@ -311,7 +311,7 @@ void DrawLegend::extremaLabel(const Info &info,
311311
style.label,
312312
*events.label,
313313
Events::Targets::measLegendLabel(text, info.properties),
314-
{.colorTransform = Gfx::ColorTransform::Fade(
314+
{.colorTransform = Gfx::ColorTransform::Opacity(
315315
Math::FuzzyBool::And(info.measureWeight, plusWeight))});
316316
}
317317

src/chart/rendering/markers/connectingmarker.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ ConnectingMarker::ConnectingMarker(const DrawingContext &ctx,
8080
std::max(minWidth, maxWidth * marker.sizeFactor, less);
8181

8282
auto horizontalFactor =
83-
isArea ? static_cast<double>(horizontal.lessAndMore())
84-
: 1;
83+
isArea ? static_cast<double>(horizontal.moreOrLess()) : 1;
8584

8685
points[2] = pos;
8786
points[1] = pos

0 commit comments

Comments
 (0)