Skip to content

Commit

Permalink
优化网格线用户体验
Browse files Browse the repository at this point in the history
  • Loading branch information
ransj committed Jul 3, 2021
1 parent 285572f commit 5f8b612
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/renderer/chart_painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ class ChartPainter extends BaseChartPainter {
@override
void drawRightText(canvas) {
var textStyle = getTextStyle(this.chartColors.defaultTextColor);
mMainRenderer.drawRightText(canvas, textStyle, mGridRows);
if(!hideGrid) {
mMainRenderer.drawRightText(canvas, textStyle, mGridRows);
}
mVolRenderer?.drawRightText(canvas, textStyle, mGridRows);
mSecondaryRenderer?.drawRightText(canvas, textStyle, mGridRows);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/renderer/main_renderer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,11 @@ class MainRenderer extends BaseChartRenderer<CandleEntity> {
TextPainter(text: span, textDirection: TextDirection.ltr);
tp.layout();
if (i == 0) {
tp.paint(canvas, Offset(chartRect.width - tp.width, topPadding));
tp.paint(canvas, Offset(0, topPadding));
} else {
tp.paint(
canvas,
Offset(chartRect.width - tp.width,
Offset(0,
rowSpace * i - tp.height + topPadding));
}
}
Expand Down

0 comments on commit 5f8b612

Please sign in to comment.