Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add average line and data point lines to line charts #12

Closed
wants to merge 1 commit into from
Closed

Add average line and data point lines to line charts #12

wants to merge 1 commit into from

Conversation

agustka
Copy link

@agustka agustka commented Jun 7, 2019

Adding extra line data to line charts which include an average line and data point lines. Also added LineStyle class and methods to draw dashed lines.

…nd data point lines. Also added LineStyle class and methods to draw dashed lines.
Copy link
Owner

@imaNNeo imaNNeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, as we talked together, I said that don't add any LineStyle, because we have to add it in another phase because borders and grids should use this too for consistency.
and I explained you completely another approach to achieve that,
let me explain it again here because these are not feet to the library codebase.
we should design it as a generic design, that possible to implement any type of use cases not just the avg line.

I explain my idea once again.
first of all lets have a base class for our line (in your example for avg line)

class FlLine { // this is a base class for our lines, (then we can use it on border and grids), should define on the base_chart_data.dart
 final Color color;
 final double strokeWidth
}
// these classes are just usable on LineCharts (or maybe BarChart or All Axis base charts),
// and you need it to draw your avg Line, or any other use cases.

classs VerticalLine extends FlLine { //let’s define this and next class on axis_chart_data.dart, because we can use them later.
  final  double y;
}

class HorizontalLine extends FlLine {
final double x;
}
// then we add it to LineChartData
class ExtraLinesData {
 final List<HorizontalLine> horizontalLines;
 final List<VerticalLine> verticalLines;
}
/ already we have this class
class LineChartData {
 …
 final ExtraLinesData extraLinesData;
 …
}

all of these was for support the average line, and for below lines that you want, we can reuse BelowBarData like this:

// already we have this class
class BelowBarData {
 …
 FlLine lineBelowSpot; // this is a line that drawn from the spot’s x and minimum y position to the spot’s x and y.
 …
}

now it is a generic design, and we can implement lots of use cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants