Closed The-Mr-L closed 2 years ago
Hi. Yes, zooming on the chart using mouse scroll is intended. Do you have any problem with this? Could you please provide some code snippets so I can help you with that?
well it is just using the example of yours and it is the same result in the live demo. zooming works but it is reversed behavior to everything else zooming related mouse wheal up should zoom in etc :) and I cant seam to figure out a way to make the chart render on new data I mean new dataset like a a new stock etc
Try changing the key when you want to reset the chart. The unique key doesn't work because it passes the same key on every build. try building your key from your data. like: key: Key(SYMBOL + TIMEFRAME)
so your chart resets every time TIMEFRAME or SYMBOL changes.
Yes that is what I have tried I am using Getx and I have made sure that the key is valid
uic is unique int id
class CandleChart extends GetView<MyController> {
final List<Indicator> indicators = [
BollingerBandsIndicator(
length: 20,
stdDev: 2,
upperColor: const Color(0xFF2962FF),
basisColor: const Color(0xFFFF6D00),
lowerColor: const Color(0xFF2962FF),
),
WeightedMovingAverageIndicator(
length: 100,
color: Colors.green.shade600,
),
];
@override
Widget build(BuildContext context) {
return Obx(() =>
Expanded(
child: Row(
children: [
Text(controller.chart.value.uic.toString()),
Candlesticks(
key:Key(controller.chart.value.uic.toString()),
candles: controller.getCandles4Chart(),
indicators: indicators,
),
],
),
),
);
}
}
and in my controller
List<candlesticks.Candle> getCandles4Chart() {
return chart.value.daily.candles
.map((c) => candlesticks.Candle(
date: DateTime.fromMillisecondsSinceEpoch(
(c.time.seconds * 1000).toInt()),
high: c.high,
low: c.low,
open: c.open,
close: c.close,
volume: c.volume))
.toList()
.reversed
.toList()
;
}
this just results in the progress circle
Are you sure that the candles List is not empty?
hey again, so I noticed that zooming on windows the zoom in is scroll down and zoom out is scroll up is that intended? and I have more general quest about what is the best way to rest the state of the chart for when I select a new instrument for charting, I get index errors when I just override my chart state, I tried adding a unique key to the constructor of the widget . I realize this might be more a flutter question, I am new to flutter :) I am just doing a prototype of my project which has a vue3+ webview2 frontend for potential refactor