OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. All rights reserved. | 2 * Copyright 2014 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style | 4 * Use of this source code is governed by a BSD-style |
5 * license that can be found in the LICENSE file or at | 5 * license that can be found in the LICENSE file or at |
6 * https://developers.google.com/open-source/licenses/bsd | 6 * https://developers.google.com/open-source/licenses/bsd |
7 */ | 7 */ |
8 | 8 |
9 library charted.demo.charts.custom_axis; | 9 library charted.demo.charts.custom_axis; |
10 | 10 |
11 import 'dart:html'; | 11 import 'dart:html'; |
12 import 'package:charted/charts/charts.dart'; | 12 import 'package:charted/charts/charts.dart'; |
13 import 'package:charted/core/scales.dart'; | 13 import 'package:charted/core/scales.dart'; |
14 | 14 |
15 List COLUMNS = [ | 15 List<ChartColumnSpec> COLUMNS = <ChartColumnSpec>[ |
16 new ChartColumnSpec(label:'Month', type:ChartColumnSpec.TYPE_STRING), | 16 new ChartColumnSpec(label:'Month', type:ChartColumnSpec.TYPE_STRING), |
17 new ChartColumnSpec(label:'Precipitation'), | 17 new ChartColumnSpec(label:'Precipitation'), |
18 new ChartColumnSpec(label:'High Temperature'), | 18 new ChartColumnSpec(label:'High Temperature'), |
19 new ChartColumnSpec(label:'Low Temperature'), | 19 new ChartColumnSpec(label:'Low Temperature'), |
20 new ChartColumnSpec(label:'Random'), | 20 new ChartColumnSpec(label:'Random'), |
21 new ChartColumnSpec(label:'Extra1'), | 21 new ChartColumnSpec(label:'Extra1'), |
22 new ChartColumnSpec(label:'Extra2'), | 22 new ChartColumnSpec(label:'Extra2'), |
23 new ChartColumnSpec(label:'Extra3'), | 23 new ChartColumnSpec(label:'Extra3'), |
24 ]; | 24 ]; |
25 | 25 |
26 List DATA = [ | 26 List<List> DATA = <List>[ |
27 ['January', 4.50, 27, 46, 1, 20, 23, 1], | 27 ['January', 4.50, 27, 46, 1, 20, 23, 1], |
28 ['February', 4.61, 60, 28, 10, 15, 45, 23], | 28 ['February', 4.61, 60, 28, 10, 15, 45, 23], |
29 ['March', 3.26, 32, 49, 100, 4, 34, 1], | 29 ['March', 3.26, 32, 49, 100, 4, 34, 1], |
30 ['April', 1.46, 63, 49, 30, 34, 89, 3] | 30 ['April', 1.46, 63, 49, 30, 34, 89, 3] |
31 ]; | 31 ]; |
32 | 32 |
33 main() { | 33 main() { |
34 // Default Chart | 34 // Default Chart |
35 var series1 = new ChartSeries("one", [1, 3, 2, 6], | 35 var series1 = new ChartSeries("one", [1, 3, 2, 6], |
36 new StackedBarChartRenderer()), | 36 new StackedBarChartRenderer()), |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 var axisConfig2 = new ChartAxisConfig(); | 74 var axisConfig2 = new ChartAxisConfig(); |
75 axisConfig2.title = 'Axis title'; | 75 axisConfig2.title = 'Axis title'; |
76 axisConfig2.scale = scale2; | 76 axisConfig2.scale = scale2; |
77 axisConfig2.tickValues = [0, 25, 50, 230, 250]; | 77 axisConfig2.tickValues = [0, 25, 50, 230, 250]; |
78 | 78 |
79 config3.registerMeasureAxis('fixed_ticks', axisConfig2); | 79 config3.registerMeasureAxis('fixed_ticks', axisConfig2); |
80 var fixedTickValueChart = new CartesianArea(querySelector('.custom-ticks'), | 80 var fixedTickValueChart = new CartesianArea(querySelector('.custom-ticks'), |
81 data3, config3, autoUpdate:false, useTwoDimensionAxes:false); | 81 data3, config3, autoUpdate:false, useTwoDimensionAxes:false); |
82 fixedTickValueChart.draw(); | 82 fixedTickValueChart.draw(); |
83 } | 83 } |
OLD | NEW |