infinum/flutter-charts

how to change to horizontal position?

andre-ab opened this issue · 2 comments

how to change to horizontal position?

image

add RotatedBox in Widge Chart

  RotatedBox(
      quarterTurns: 1,
      child: Chart(...),
      )

add rotated box in widget chart,
The problem was only with the numbers "0,1.."

image

Hey @andre-ab. There is no easy way to do this yet. You would have to make your own decoration with rotated values. You can do that with WidgetDecoration as well. ex:

WidgetDecoration(
  widgetDecorationBuilder: (builder, state, itemWidth, verticalMultiplier) {
    return Stack(
      children: [
        ...List.generate(
          state.data.listSize,
          (index) => Positioned(
            bottom: 0,
            width: itemWidth,
            height: 32,
            left: index * itemWidth,
            child: Center(
              child: RotatedBox(
                quarterTurns: 3,
                child: Text('$index'),
              ),
            ),
          ),
        ),
      ],
    );
  },
  margin: EdgeInsets.only(bottom: 32),
)