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

Draw the side titles inside the chart. #1176

Closed
adrianvintu opened this issue Oct 18, 2022 · 7 comments
Closed

Draw the side titles inside the chart. #1176

adrianvintu opened this issue Oct 18, 2022 · 7 comments
Labels
Line Chart question Further information is requested

Comments

@adrianvintu
Copy link

adrianvintu commented Oct 18, 2022

I am trying to achieve the design in this image, but fail to.
fl_chart

The best is get is this
fl_chart 2

Is if possible in fl_chart to:

  1. have the leftTitles render on top of the lines, instead of to the left of the line?
  2. have empty circles as index indicators? I now use getTouchedSpotIndicator FlDotCirclePainter to set the white border, but if I set the FlDotCirclePainter(color: Colors.transparent, the bar line will show to the middle of the dot circle like here

fl_chart 3

  1. have the top/bottom line of the graph rendered as dots? it seems I can only render it as line or invisible via
borderData: FlBorderData(
        border: Border(
          bottom: BorderSide(
            color: Colors.yellow,
            width: 4.4,
            style: BorderStyle.none,
          ),

Related ticket: #1150

Thank you for your wonderful product which I already use in 2 projects. Wish you all the best!

@imaNNeo
Copy link
Owner

imaNNeo commented Jan 15, 2023

Hi.
As you can pass a widget as a title, you leverage the power of flutter. Widgets.
You can wrap your Text widget (or any other widget) with Transform.translate widget to move your text with an offset.

Check the below sample (full code is here):

image

@imaNNeo imaNNeo closed this as completed Jan 15, 2023
@imaNNeo imaNNeo changed the title Can fl_chart render like this? Draw the side titles inside the chart. Jan 15, 2023
@imaNNeo imaNNeo added question Further information is requested Line Chart labels Jan 15, 2023
@adrianvintu
Copy link
Author

Thank you very much. I am assuming pints #2 and #3 are not doable thane, right?

@imaNNeo
Copy link
Owner

imaNNeo commented Jan 15, 2023

What do you mean?

@adrianvintu
Copy link
Author

There are 3 points to the ticket. I think you only answered the first one. Can you maybe reread the ticket text?

@imaNNeo
Copy link
Owner

imaNNeo commented Jan 15, 2023

Aha I missed them.
2. You need to write your own Painter. (just read the FlDotCirclePainter to learn more about it)
3. Unfortunately you can't render as dots. You can only render them as dashed lines.

@adrianvintu
Copy link
Author

Thank you very much!

Keep up the awesome work!

@imaNNeo
Copy link
Owner

imaNNeo commented Jan 15, 2023

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Line Chart question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants