Comments (7)
It should.
Can you please provide your example code to let me check the problem.
from graphic.
return Observer(builder: (_) {
if (context.watch<ResultatsStore>().answersChart.isEmpty) {
return Center(
child: Text(
'Aucune donnée disponible',
style: Theme.of(context).textTheme.headline6,
),
);
}
return Chart(
data: context.watch<ResultatsStore>().answersChart,
variables: {
'Note': Variable(
accessor: (Map map) => map['Note'] as String,
),
'Réponses': Variable(
accessor: (Map map) => map['Réponses'] as num,
),
'index': Variable(
accessor: (Map map) => map['index'] as num,
),
},
elements: [
IntervalElement(
color: ColorAttr(
variable: 'index',
values: [
Palette.rose,
Palette.green,
Palette.grey,
],
),
size: SizeAttr(
value: (mediaQuery.width /
context.watch<ResultatsStore>().answersChart.length) *
0.5,
),
),
],
axes: [
Defaults.horizontalAxis,
Defaults.verticalAxis,
],
selections: {
'tap': PointSelection(
on: {
GestureType.hover,
GestureType.tap,
},
dim: 1,
)
},
tooltip: TooltipGuide(
backgroundColor: Palette.black,
elevation: 5,
textStyle: TextStyles.caption.copyWith(color: Palette.white),
variables: ['Note', 'Réponses'],
),
crosshair: CrosshairGuide(),
);
});
Note here that answersChart
is a List<Map<String, dynamic>>
modified inside ResultatsStore
calling this method:
@action
void calculateAnswersChart() {
answersChart.clear();
log.fine('calculateAnswersChart | rs.copyMap: ${copyMap.length}');
for (final entry in copyMap.entries) {
final copy = entry.value;
final notes = copy.notes[critere?.idDef];
final notesStr = (critere as Question)
.propositions
.map((e) => String.fromCharCode(96 + e.numero).toUpperCase())
.toSet()
.toList();
String note = '';
// fill with all default notes
for (final noteStr in notesStr) {
answersChart.add(ObservableMap<String, dynamic>.of(<String, dynamic>{
'index': 0,
'Note': noteStr,
'Réponses': 0,
}));
}
etc...
PS: somehow I can't click on the graph bars
from graphic.
Also, even if I remove the Observer
it still ends with the same result, the chart goes blank when data are updated.
The only way to have the updated chart is to switch to a different view and then come back to the chart.
I suppose it redraws when views are switched).
from graphic.
The data updating problem is caused by a bug in the _ChartLayoutDelegate.
I have fixed it in the v0.6.1, please have a try. (It requires a Flutter version greater than 2.6.0, there is a breaking change in the gesture lib).
The click problem dosen't show in my test, I copied your selections and tooltip setting.
from graphic.
Oh one last problem, seems like in a bar chart, say there are 2 labels and each one have a value of 1, no bar is displayed
Example, if this is my data:
[{index: 0, label: 0, value: 1, color: Color(0xffb64384)}, {index: 1, label: 1, value: 1, color: Color(0xfff8bf2f)}]
then the chart is empty (the labels are displayed but there is no bar).
from graphic.
If the label position is right, the problem may caused by color or size attribute.
from graphic.
I'll take a look, thanks. I close the issue since the original one is patched (works like a charm).
from graphic.
Related Issues (20)
- 处理10万个数据时候有点慢,有优化空间吗
- 添加动画后,点击图表或者在图表上移动,都会触发动画。 HOT 2
- renderBasicitem not found
- 内置的PointSelector不适合用于计算饼图/日出图等带角度的图表的选中域,能否将Selector开放到Selection中做参数以方便定制化?
- Configuration for Labels inside PolarCoord/PieChart HOT 2
- PieChart Selection HOT 1
- Take a look at my design!
- 对数坐标
- [BUG] Pinch zoom gesture causes an exception
- Error in TooltipRenderOp.render when a NaN value is selected
- Candlechart does not render circuit data points as it has same ohlc for that particular candle.
- Is it possible to Scroll only the barchart data and x axis without scrolling the y axis
- Add button to tooltip
- Mark transition and selections doesn't work well together.
- 如何实现Line Chart的实时变化 HOT 2
- Question: How to create this chart
- horizontalRangeUpdater 如何实现滚动到第一个坐标就截止,最后一个坐标也截止 HOT 1
- Is is possible to put a label to a graph axis? HOT 2
- Communicating with other widgets HOT 1
- Tool tip not working on iOS HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphic.