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

Step Y Axis missing Label. Bubble Indicator cut off at top. #34

Closed
PlymouthRock opened this issue Aug 11, 2019 · 17 comments
Closed

Step Y Axis missing Label. Bubble Indicator cut off at top. #34

PlymouthRock opened this issue Aug 11, 2019 · 17 comments

Comments

@PlymouthRock
Copy link

chart-with-step-y-axis

We're having an issue when setting a Custom Scale chart to display the Y axis with steps set to 2.

  • The step number below the top indicator is missing. This only happens when doing a non-debug build.
  • The bubble indicator is cut off at the top

Thank you for your efforts on this widget!

`Container(
color: Colors.transparent,
height: 250,
child: BezierChart(
bezierChartScale: BezierChartScale.CUSTOM,
xAxisCustomValues: const [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],
footerValueBuilder: (double value) {

              int hour = value.toInt();

              if(hour == 0) {
                return '12 am';
              } else if (hour < 12) {
                return '$hour am';
              } else {
                return '${hour > 12 ? hour - 12 : hour} pm';
              }
            },
            series: [
              BezierLine(
                lineColor: Colors.blue,
                lineStrokeWidth: 2.0,
                label: "feet",
                data: dataPoints,
              ),
            ],
            config: BezierChartConfig(
              verticalIndicatorStrokeWidth: 2.0,
              verticalIndicatorColor: Colors.grey.shade800,
              bubbleIndicatorColor: Colors.grey.shade800,
              displayYAxis: true,
              startYAxisFromNonZeroValue: false,
              stepsYAxis: 2,
              contentWidth: 1400,
              bubbleIndicatorTitleStyle: TextStyle(
                color: Colors.grey.shade800,
              ),
              bubbleIndicatorValueStyle: TextStyle(
                color: Colors.white
              ),
              yAxisTextStyle: TextStyle (
                fontSize: 14
              ),
              xAxisTextStyle: TextStyle (
                fontSize: 14
              ),
            ),
          )
        ),`
@PlymouthRock
Copy link
Author

It looks like the missing step number and top number is hidden if you have a background color set. So this is no longer an issue.

@diegoveloper
Copy link
Collaborator

You can close the issue then :)

@PlymouthRock
Copy link
Author

I still have an issue with the bubble indicator being cut off at the top. Is there some setting I'm missing?

@diegoveloper
Copy link
Collaborator

diegoveloper commented Aug 12, 2019 via email

@diegoveloper
Copy link
Collaborator

diegoveloper commented Aug 16, 2019 via email

@PlymouthRock
Copy link
Author

I made the container colors Transparent and it's still cut off.

@PlymouthRock
Copy link
Author

chart-debug-cut-off
Here's what it looks like in Debug mode. I get that Red bar at the top.

@PlymouthRock
Copy link
Author

All of your samples use whole numbers. Could it be that we are using decimals. So instead of 10 we have 10.2.

@diegoveloper
Copy link
Collaborator

diegoveloper commented Aug 16, 2019 via email

@PlymouthRock
Copy link
Author

Tried that. I don't think it's a color issue. I think the issue is the height calculation of the chart widget needs to be adjusted. Let me create a simple test example and see if I can recreate the issue. Maybe its my app.

@diegoveloper
Copy link
Collaborator

ok let me know if I can help you

@angel1st
Copy link
Contributor

I have the similar issue, re bubble indicator, but it was cut off, when the chart scrolls to the leftmost side. See the screenshot below:
Screenshot_1566035965

@PlymouthRock
Copy link
Author

It looks like it's a combination of things that is causing the bubble to be cut off:

  1. Setting the container height to 250
  2. Having the highest Value be a decimal number
  3. Setting a larger font size on the Y Axis

I modified sample1 to duplicate the issue.

Widget sample1(BuildContext context) {
    return Center(
      child: Container(
        color: Colors.red,
        height: 250, //MediaQuery.of(context).size.height / 2,
        width: MediaQuery.of(context).size.width * 0.9,
        child: BezierChart(
          bezierChartScale: BezierChartScale.CUSTOM,
          xAxisCustomValues: const [0, 5, 10, 15, 20, 25, 30, 35],
          series: const [
            BezierLine(
              data: const [
                DataPoint<double>(value: 2, xAxis: 0),
                DataPoint<double>(value: 4, xAxis: 5),
                DataPoint<double>(value: 6, xAxis: 10),
                DataPoint<double>(value: 8, xAxis: 15),
                DataPoint<double>(value: 10.3, xAxis: 20),
                DataPoint<double>(value: 7, xAxis: 25),
                DataPoint<double>(value: 5, xAxis: 30),
                DataPoint<double>(value: 3, xAxis: 35),
              ],
            ),
          ],
          config: BezierChartConfig(
            verticalIndicatorStrokeWidth: 3.0,
            verticalIndicatorColor: Colors.black26,
            showVerticalIndicator: true,
            backgroundColor: Colors.red,
            displayYAxis: true,
            startYAxisFromNonZeroValue: false,
            stepsYAxis: 2,
            yAxisTextStyle: TextStyle(color: Colors.white, fontSize: 14),
          ),
        ),
      ),
    );
  }

@angel1st
Copy link
Contributor

angel1st commented Aug 17, 2019

I decided to file a separate issue, since the both cases seem different to me.

@diegoveloper
Copy link
Collaborator

could you use flutter packages upgrade and try again?

@angel1st
Copy link
Contributor

I rather wait until bubbleLabelCallback is merged, so I would try to kill two birds with one stone :-)

@PlymouthRock
Copy link
Author

That fixed it! Bubble Indicator is no longer cut off at the top. Thanks!

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

No branches or pull requests

3 participants