Skip to content

Commit 8a63efd

Browse files
committed
Update example project documentation
1 parent 2df093c commit 8a63efd

File tree

3 files changed

+28
-20
lines changed

3 files changed

+28
-20
lines changed

example/lib/main.dart

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,25 +51,32 @@ class _MyAppState extends State<MyApp> {
5151
minimum: const EdgeInsets.all(24.0),
5252
child: InteractiveChart(
5353
candles: _data,
54-
style: ChartStyle(
55-
priceGainColor: Colors.teal[200]!,
56-
priceLossColor: Colors.blueGrey,
57-
volumeColor: Colors.teal.withOpacity(0.8),
58-
trendLineColor: Colors.blueGrey[200]!,
59-
priceGridLineColor: Colors.blue[200]!,
60-
priceLabelStyle: TextStyle(color: Colors.blue[200]),
61-
timeLabelStyle: TextStyle(color: Colors.blue[200]),
62-
selectionHighlightColor: Colors.red.withOpacity(0.2),
63-
overlayBackgroundColor: Colors.red[900]!.withOpacity(0.6),
64-
overlayTextStyle: TextStyle(color: Colors.red[100]),
65-
timeLabelHeight: 32,
66-
),
67-
overlayInfo: (candle) => {
68-
"💎": "🤚 ",
69-
"高": "${candle.high?.toStringAsFixed(2)}",
70-
"低": "${candle.low?.toStringAsFixed(2)}",
71-
},
72-
priceLabel: (price) => "${price.round()} 💎",
54+
/** Uncomment the following to see more examples */
55+
/** Example styling */
56+
// style: ChartStyle(
57+
// priceGainColor: Colors.teal[200]!,
58+
// priceLossColor: Colors.blueGrey,
59+
// volumeColor: Colors.teal.withOpacity(0.8),
60+
// trendLineColor: Colors.blueGrey[200]!,
61+
// priceGridLineColor: Colors.blue[200]!,
62+
// priceLabelStyle: TextStyle(color: Colors.blue[200]),
63+
// timeLabelStyle: TextStyle(color: Colors.blue[200]),
64+
// selectionHighlightColor: Colors.red.withOpacity(0.2),
65+
// overlayBackgroundColor: Colors.red[900]!.withOpacity(0.6),
66+
// overlayTextStyle: TextStyle(color: Colors.red[100]),
67+
// timeLabelHeight: 32,
68+
// ),
69+
/** Customize axis labels */
70+
// timeLabel: (timestamp, visibleDataCount) => "📅",
71+
// priceLabel: (price) => "${price.round()} 💎",
72+
/** Customize overlay (tap and hold to see it)
73+
** Or return a blank object to disable it. */
74+
// overlayInfo: (candle) => {
75+
// "💎": "🤚 ",
76+
// "Hi": "${candle.high?.toStringAsFixed(2)}",
77+
// "Lo": "${candle.low?.toStringAsFixed(2)}",
78+
// },
79+
7380
),
7481
),
7582
),

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ packages:
7373
path: ".."
7474
relative: true
7575
source: path
76-
version: "0.0.1"
76+
version: "0.2.0"
7777
intl:
7878
dependency: transitive
7979
description:

lib/src/chart_painter.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ class ChartPainter extends CustomPainter {
219219
..layout();
220220

221221
final info = getOverlayInfo(candle);
222+
if (info.isEmpty) return;
222223
final labels = info.keys.map((text) => makeTP(text)).toList();
223224
final values = info.values.map((text) => makeTP(text)).toList();
224225

0 commit comments

Comments
 (0)