infinum/flutter-charts

The named parameter 'chartBehaviour' isn't defined

roly151 opened this issue ยท 5 comments

My chart is working well, but I'd like to add onItemClicked. But when I try to add the chartBehaviour parameter, it gives me the error saying it isn't defined.

I am using the feature/render-object branch, and here is my code

Widget rangeChart(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.symmetric(vertical: 8.0),
      child: Container(
        width: 100.0,
        child: Chart(
          state: ChartState.bar(
            ChartData.fromList(
                forecastTemps.map((CandleItem item) => CandleValue<void>(item.min, item.max)).toList(),
                axisMax: dailyHigh.toDouble(),
                axisMin: dailyMin.toDouble()
            ),
            
            itemOptions: BarItemOptions(
              padding: EdgeInsets.symmetric(horizontal: candlePadding),
              radius: BorderRadius.all(Radius.circular(18.0)),
              gradient: candleColor(),
            ),
            chartBehaviour: ChartBehaviour(onItemClicked: (item) {
              
            }),
            backgroundDecorations: [
              GridDecoration(
                showHorizontalValues: false,
                showVerticalValues: true,
                verticalAxisValueFromIndex: (int value) {
                  return DateFormat.E()
                      .format(now.add(new Duration(days: value+1)))
                      .toString();
                },
                verticalAxisStep: 1,
                horizontalAxisStep: 3,
                textStyle: TextStyle(color: Colors.white),
                gridColor: Theme.of(context).dividerColor,
              ),
            ],
            foregroundDecorations: [
              ValueDecoration(
                //alignment: Alignment.topCenter,
                textStyle: TextStyle(color: Colors.white),
              ),
              ValueDecoration(
                textStyle: TextStyle(color: Colors.white),
                alignment: Alignment.bottomCenter,
                valueGenerator: (item) => item.min ?? 0,
              ),
            ],
          ),
        ),
      ),
    );
  }

Hey @roly151, With new render-object branch this part is not yet working. I'm currently trying to fix that so new version of the lib can be out.
Should be fixed in following weeks ๐Ÿ˜ƒ

๐Ÿ‘

Hi, do you have a rough estimate as to when you might be able to release the new version you are working on? I really like your charts and have built a couple of charts using your render object branch. I can only release once that branch is completed. Thanks!

Hey, plan is to try to release new version next week. But this issue has been fixed in render-object branch ๐Ÿ™‚

Merged, new version is 2.0.0 ๐Ÿ˜„