Showing
6 changed files
with
112 additions
and
86 deletions
... | @@ -3,6 +3,8 @@ import { View, Text, StyleSheet,ScrollView, RefreshControl } from 'react-native' | ... | @@ -3,6 +3,8 @@ import { View, Text, StyleSheet,ScrollView, RefreshControl } from 'react-native' |
3 | import { BarChart, Grid } from 'react-native-svg-charts' | 3 | import { BarChart, Grid } from 'react-native-svg-charts' |
4 | import HistoryGraph from '../component/HistoryGraph' | 4 | import HistoryGraph from '../component/HistoryGraph' |
5 | import SegmentedControlTab from "react-native-segmented-control-tab"; | 5 | import SegmentedControlTab from "react-native-segmented-control-tab"; |
6 | +import {add_data} from'../component/DBhelper.js'; | ||
7 | + | ||
6 | const data1 = [ | 8 | const data1 = [ |
7 | { label: 'MON', value: 1.8 }, | 9 | { label: 'MON', value: 1.8 }, |
8 | { label: 'TUE', value: 4.2 }, | 10 | { label: 'TUE', value: 4.2 }, |
... | @@ -61,7 +63,8 @@ export default class HomeTab extends Component { | ... | @@ -61,7 +63,8 @@ export default class HomeTab extends Component { |
61 | 63 | ||
62 | _onRefresh = () => { | 64 | _onRefresh = () => { |
63 | this.setState({refresing: true}); | 65 | this.setState({refresing: true}); |
64 | - this.setState({data: data4}) | 66 | + // this.setState({data: data4}) |
67 | + this.get_diff_data(); | ||
65 | this.setState({refreshing: false}); | 68 | this.setState({refreshing: false}); |
66 | } | 69 | } |
67 | 70 | ||
... | @@ -81,21 +84,21 @@ export default class HomeTab extends Component { | ... | @@ -81,21 +84,21 @@ export default class HomeTab extends Component { |
81 | }; | 84 | }; |
82 | 85 | ||
83 | get_diff_data(){ | 86 | get_diff_data(){ |
84 | - return fetch('http://10.0.2.2:3000/app/get_diff_data/',{ | 87 | + return fetch('http://testloadbalancer-1847561458.ap-northeast-2.elb.amazonaws.com/app/get_diff_data/',{ |
85 | method:'POST', | 88 | method:'POST', |
86 | headers: { | 89 | headers: { |
87 | 'Accept': 'application/json', | 90 | 'Accept': 'application/json', |
88 | 'Content-Type': 'application/json', | 91 | 'Content-Type': 'application/json', |
89 | }, | 92 | }, |
90 | body:JSON.stringify({ | 93 | body:JSON.stringify({ |
91 | - ras_id : this.state.ID, | 94 | + ras_id : "pi1", |
92 | - date : this.state.today, | 95 | + date : "1576339901541", |
93 | }), | 96 | }), |
94 | }) | 97 | }) |
95 | - .then((response) => console.log(response.json())) | 98 | + .then((response) => response.json()) |
96 | .then((responseJson)=> { | 99 | .then((responseJson)=> { |
97 | console.log(responseJson) | 100 | console.log(responseJson) |
98 | - alert(responseJson[0].ras_id.S); | 101 | + add_data(responseJson) |
99 | },function(){ | 102 | },function(){ |
100 | }) | 103 | }) |
101 | .catch((error) => { | 104 | .catch((error) => { |
... | @@ -114,29 +117,33 @@ export default class HomeTab extends Component { | ... | @@ -114,29 +117,33 @@ export default class HomeTab extends Component { |
114 | // ); | 117 | // ); |
115 | 118 | ||
116 | return( | 119 | return( |
117 | - <ScrollView | 120 | + <ScrollView style = {style.container} |
118 | refreshControl={ | 121 | refreshControl={ |
119 | <RefreshControl | 122 | <RefreshControl |
120 | refreshing={this.state.refreshing} | 123 | refreshing={this.state.refreshing} |
121 | onRefresh={this._onRefresh} | 124 | onRefresh={this._onRefresh} |
122 | - tintColor="#ff0000" | 125 | + tintColor="#000000" |
123 | title="Loading..." | 126 | title="Loading..." |
124 | - titleColor="#00ff00" | 127 | + titleColor="#0066cc" |
125 | - colors={["#ff0000",'#00ff00','#0000ff']} | 128 | + colors={["#ffffff",'#0066cc','#ffffff']} |
126 | - progressBackgroundColor="#ffff00" | 129 | + progressBackgroundColor="#0066cc" |
127 | /> | 130 | /> |
128 | } | 131 | } |
129 | > | 132 | > |
133 | + <View style = {style.container}> | ||
130 | <View style={style.header}> | 134 | <View style={style.header}> |
131 | <Text style={style.tabName}>History </Text> | 135 | <Text style={style.tabName}>History </Text> |
132 | </View> | 136 | </View> |
133 | - <Text>{this.state.title}</Text> | 137 | + <View style={{flex : 8, justifyContent:'center'}}> |
138 | + <Text style ={style.date_text}>{this.state.title}</Text> | ||
139 | + </View> | ||
134 | <SegmentedControlTab | 140 | <SegmentedControlTab |
135 | values={["Week", "Month", "Year"]} | 141 | values={["Week", "Month", "Year"]} |
136 | selectedIndex={this.state.selectedIndex} | 142 | selectedIndex={this.state.selectedIndex} |
137 | onTabPress={this.handleIndexChange} | 143 | onTabPress={this.handleIndexChange} |
138 | /> | 144 | /> |
139 | <HistoryGraph data={this.state.data} round={100} unit="kg"/> | 145 | <HistoryGraph data={this.state.data} round={100} unit="kg"/> |
146 | + </View> | ||
140 | </ScrollView> | 147 | </ScrollView> |
141 | ) | 148 | ) |
142 | } | 149 | } |
... | @@ -145,12 +152,11 @@ export default class HomeTab extends Component { | ... | @@ -145,12 +152,11 @@ export default class HomeTab extends Component { |
145 | const style = StyleSheet.create({ | 152 | const style = StyleSheet.create({ |
146 | container: { | 153 | container: { |
147 | flex: 1, | 154 | flex: 1, |
148 | - alignItems: 'center', | ||
149 | - justifyContent: 'center', | ||
150 | }, | 155 | }, |
151 | header: { | 156 | header: { |
152 | - flex :1, | 157 | + flex :2, |
153 | justifyContent : 'center', | 158 | justifyContent : 'center', |
159 | + padding : 10, | ||
154 | }, | 160 | }, |
155 | tabName:{ | 161 | tabName:{ |
156 | marginStart : 10, | 162 | marginStart : 10, |
... | @@ -158,5 +164,10 @@ const style = StyleSheet.create({ | ... | @@ -158,5 +164,10 @@ const style = StyleSheet.create({ |
158 | fontSize : 20, | 164 | fontSize : 20, |
159 | color : "#0066cc", | 165 | color : "#0066cc", |
160 | fontWeight: 'bold', | 166 | fontWeight: 'bold', |
167 | + }, | ||
168 | + date_text:{ | ||
169 | + fontSize :20, | ||
170 | + marginStart:5, | ||
171 | + textAlignVertical:'center' | ||
161 | } | 172 | } |
162 | }) | 173 | }) |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -2,7 +2,7 @@ import React, { Component } from 'react'; | ... | @@ -2,7 +2,7 @@ import React, { Component } from 'react'; |
2 | import { View, Text, StyleSheet, SafeAreaView, ScrollView, Image } from 'react-native'; | 2 | import { View, Text, StyleSheet, SafeAreaView, ScrollView, Image } from 'react-native'; |
3 | import Circle from '../component/circle_component' | 3 | import Circle from '../component/circle_component' |
4 | import {Table, TableWrapper, Row,Rows} from 'react-native-table-component' | 4 | import {Table, TableWrapper, Row,Rows} from 'react-native-table-component' |
5 | -import {get_now_weight, get_today_data} from'../component/DBhelper.js'; | 5 | +import {get_now_weight, get_today_data, add_data} from'../component/DBhelper.js'; |
6 | 6 | ||
7 | var date = new Date(); | 7 | var date = new Date(); |
8 | date.setHours(date.getHours()+9); | 8 | date.setHours(date.getHours()+9); |
... | @@ -10,43 +10,39 @@ var month = date.getMonth()+1; | ... | @@ -10,43 +10,39 @@ var month = date.getMonth()+1; |
10 | if(month == 11){ | 10 | if(month == 11){ |
11 | month = 12 | 11 | month = 12 |
12 | } | 12 | } |
13 | -export default class HomeTab extends Component { | ||
14 | 13 | ||
14 | +export default class HomeTab extends Component { | ||
15 | constructor(props){ | 15 | constructor(props){ |
16 | super(props); | 16 | super(props); |
17 | this.state = { | 17 | this.state = { |
18 | ID : this.props.navigation.getParam('id','pi1'), | 18 | ID : this.props.navigation.getParam('id','pi1'), |
19 | - // today : date.getFullYear() + "." + month + "." + date.getDate(), | 19 | + today : date.getFullYear() + "." + month + "." + date.getDate(), |
20 | - today : "1576237044146.4011", | ||
21 | current_weight : get_now_weight() , | 20 | current_weight : get_now_weight() , |
22 | table_contents : get_today_data() | 21 | table_contents : get_today_data() |
23 | } | 22 | } |
24 | } | 23 | } |
25 | - | ||
26 | get_diff_data(){ | 24 | get_diff_data(){ |
27 | - return fetch('http://10.0.2.2:3000/app/get_diff_data/',{ | 25 | + return fetch('http://testloadbalancer-1847561458.ap-northeast-2.elb.amazonaws.com/app/get_diff_data/',{ |
28 | method:'POST', | 26 | method:'POST', |
29 | headers: { | 27 | headers: { |
30 | 'Accept': 'application/json', | 28 | 'Accept': 'application/json', |
31 | 'Content-Type': 'application/json', | 29 | 'Content-Type': 'application/json', |
32 | }, | 30 | }, |
33 | body:JSON.stringify({ | 31 | body:JSON.stringify({ |
34 | - ras_id : this.state.ID, | 32 | + ras_id : "pi1", |
35 | - //date : date, | 33 | + date : "1576339901541", |
36 | - date : "1576237047226.6567" | ||
37 | }), | 34 | }), |
38 | }) | 35 | }) |
39 | - .then((response) => console.log(response.json())) | 36 | + .then((response) => response.json()) |
40 | .then((responseJson)=> { | 37 | .then((responseJson)=> { |
41 | - //alert(responseJson[0][0].ras_id.S); | ||
42 | console.log(responseJson) | 38 | console.log(responseJson) |
39 | + add_data(responseJson); | ||
43 | },function(){ | 40 | },function(){ |
44 | }) | 41 | }) |
45 | .catch((error) => { | 42 | .catch((error) => { |
46 | console.error(error); | 43 | console.error(error); |
47 | }) | 44 | }) |
48 | } | 45 | } |
49 | - | ||
50 | render() { | 46 | render() { |
51 | return ( | 47 | return ( |
52 | <View style={style.container}> | 48 | <View style={style.container}> |
... | @@ -64,7 +60,7 @@ export default class HomeTab extends Component { | ... | @@ -64,7 +60,7 @@ export default class HomeTab extends Component { |
64 | </View> | 60 | </View> |
65 | <View style={this.state.current_weight}> | 61 | <View style={this.state.current_weight}> |
66 | <Circle | 62 | <Circle |
67 | - title={this.state.current_weight} | 63 | + title={this.state.current_weight/1000} |
68 | onPress={()=>{this.get_diff_data()}}> | 64 | onPress={()=>{this.get_diff_data()}}> |
69 | </Circle> | 65 | </Circle> |
70 | </View> | 66 | </View> |
... | @@ -87,7 +83,6 @@ export default class HomeTab extends Component { | ... | @@ -87,7 +83,6 @@ export default class HomeTab extends Component { |
87 | ); | 83 | ); |
88 | } | 84 | } |
89 | } | 85 | } |
90 | - | ||
91 | const style = StyleSheet.create({ | 86 | const style = StyleSheet.create({ |
92 | container: { | 87 | container: { |
93 | flex: 1, | 88 | flex: 1, | ... | ... |
... | @@ -31,7 +31,6 @@ export default class SettingTab extends Component { | ... | @@ -31,7 +31,6 @@ export default class SettingTab extends Component { |
31 | .then((response) => console.log(response.json())) | 31 | .then((response) => console.log(response.json())) |
32 | .then((responseJson)=> { | 32 | .then((responseJson)=> { |
33 | console.log(responseJson) | 33 | console.log(responseJson) |
34 | - },function(){ | ||
35 | }) | 34 | }) |
36 | .catch((error) => { | 35 | .catch((error) => { |
37 | console.error(error); | 36 | console.error(error); |
... | @@ -40,7 +39,7 @@ export default class SettingTab extends Component { | ... | @@ -40,7 +39,7 @@ export default class SettingTab extends Component { |
40 | 39 | ||
41 | delete_id(){ | 40 | delete_id(){ |
42 | this.setState({ID: ''}) | 41 | this.setState({ID: ''}) |
43 | - save_app_data() | 42 | + //save_app_data() |
44 | delete_all_data() | 43 | delete_all_data() |
45 | } | 44 | } |
46 | render() { | 45 | render() { |
... | @@ -81,7 +80,7 @@ export default class SettingTab extends Component { | ... | @@ -81,7 +80,7 @@ export default class SettingTab extends Component { |
81 | onChangeText={(text)=>this.setState({ID:text})}/> | 80 | onChangeText={(text)=>this.setState({ID:text})}/> |
82 | </View> | 81 | </View> |
83 | <AddButton | 82 | <AddButton |
84 | - onPress={()=>{this.save_app_data()}}/> | 83 | + onPress={()=>{this.save_app_data}}/> |
85 | </View> | 84 | </View> |
86 | </View> | 85 | </View> |
87 | </View> | 86 | </View> | ... | ... |
... | @@ -16,11 +16,9 @@ export default class Login extends Component { | ... | @@ -16,11 +16,9 @@ export default class Login extends Component { |
16 | }; | 16 | }; |
17 | 17 | ||
18 | getdata() { | 18 | getdata() { |
19 | - return fetch('http://10.0.2.2:3000/app/get_data/uid1') | 19 | + return fetch('http://testloadbalancer-1847561458.ap-northeast-2.elb.amazonaws.com/app/get_data/pi1') |
20 | .then((response) => response.json()) | 20 | .then((response) => response.json()) |
21 | .then((responseJson) => { | 21 | .then((responseJson) => { |
22 | - // alert(responseJson[0].ras_id.S); | ||
23 | - //alert(responseJson.length) | ||
24 | add_data(responseJson); | 22 | add_data(responseJson); |
25 | }) | 23 | }) |
26 | .catch((error) => { | 24 | .catch((error) => { |
... | @@ -28,6 +26,10 @@ export default class Login extends Component { | ... | @@ -28,6 +26,10 @@ export default class Login extends Component { |
28 | }); | 26 | }); |
29 | } | 27 | } |
30 | 28 | ||
29 | + navigate(){ | ||
30 | + | ||
31 | + } | ||
32 | + | ||
31 | render() { | 33 | render() { |
32 | return ( | 34 | return ( |
33 | <View style={styles.container}> | 35 | <View style={styles.container}> |
... | @@ -55,8 +57,9 @@ export default class Login extends Component { | ... | @@ -55,8 +57,9 @@ export default class Login extends Component { |
55 | onChangeText={(text) => {this.setState({ID:text})}} | 57 | onChangeText={(text) => {this.setState({ID:text})}} |
56 | /> | 58 | /> |
57 | <LoginButton | 59 | <LoginButton |
58 | - // onPress={()=>getdata} | 60 | + //onPress={()=>{this.getdata}} |
59 | - onPress={() =>{ this.getdata().then(this.props.navigation.navigate('MainScreen', { ID: this.state.ID })) }} | 61 | + onPress={() =>{ this.props.navigation.navigate('MainScreen', { ID: this.state.ID });}} |
62 | + //onPress={() =>{ this.getdata().then(()=>{this.props.navigation.navigate('MainScreen', { ID: this.state.ID })}) }} | ||
60 | /> | 63 | /> |
61 | </View> | 64 | </View> |
62 | </View> | 65 | </View> | ... | ... |
... | @@ -14,54 +14,35 @@ Waste.schema = { | ... | @@ -14,54 +14,35 @@ Waste.schema = { |
14 | // Get the default Realm with support for our objects | 14 | // Get the default Realm with support for our objects |
15 | let realm = new Realm({schema: [Waste]}); | 15 | let realm = new Realm({schema: [Waste]}); |
16 | 16 | ||
17 | -// // Create Realm objects and write to local storage | ||
18 | -// realm.write(() => { | ||
19 | -// let myWaste = realm.create('Waste', { | ||
20 | -// weight: 1655, | ||
21 | -// diff: 500, | ||
22 | -// date: '1576236841329.253', | ||
23 | -// }); | ||
24 | -// // myWaste.miles += 2SS0; // Update a property value | ||
25 | -// }); | ||
26 | - | ||
27 | -// // Query Realm for all cars with a high mileage | ||
28 | -// let wastes = realm.objects('Waste').filtered('weight > 1000'); | ||
29 | - | ||
30 | -// // Will return a Results object with our 1 car | ||
31 | -// cars.length // => 1 | ||
32 | - | ||
33 | -// // Add another car | ||
34 | -// realm.write(() => { | ||
35 | -// let myCar = realm.create('Car', { | ||
36 | -// make: 'Ford', | ||
37 | -// model: 'Focus', | ||
38 | -// miles: 2000, | ||
39 | -// }); | ||
40 | -// }); | ||
41 | -// // Query results are updated in realtime | ||
42 | -// cars.length // => 2 | ||
43 | - | ||
44 | export function add_data(responseJson){ | 17 | export function add_data(responseJson){ |
45 | for(i = 0; i < responseJson.length; i++){ | 18 | for(i = 0; i < responseJson.length; i++){ |
46 | realm.write(() => { | 19 | realm.write(() => { |
47 | // responseJson[0].ras_id.S | 20 | // responseJson[0].ras_id.S |
48 | let myWaste = realm.create('Waste', { | 21 | let myWaste = realm.create('Waste', { |
49 | - weight: Number(responseJson[i].weight.N), | 22 | + weight: parseFloat(responseJson[i].weight.N), |
50 | - diff: Number(responseJson[i].diff.N), | 23 | + diff: parseFloat(responseJson[i].diff.N), |
51 | - date: Number(responseJson[i].save_date.S), | 24 | + date: parseFloat(responseJson[i].save_date.S), |
52 | }); | 25 | }); |
53 | }); | 26 | }); |
54 | - } | ||
55 | 27 | ||
28 | + console.log(responseJson[i].save_date.S) | ||
29 | + } | ||
56 | return responseJson.length; | 30 | return responseJson.length; |
57 | } | 31 | } |
58 | 32 | ||
59 | export function get_now_weight(){ | 33 | export function get_now_weight(){ |
60 | let wastes = realm.objects('Waste'); | 34 | let wastes = realm.objects('Waste'); |
61 | - let recent = realm.objects('Waste').max('date').date; | 35 | + let recent = wastes.max('date'); |
62 | - let recentWeight = wastes.filtered('date = 1576223063238.5166'); | 36 | + |
63 | - //"id == %@", id! | 37 | + var recentWeight = wastes.filtered('date = $0', recent); |
64 | - console.log(String(wastes.lenth)); | 38 | + console.log("now_weight",recentWeight) |
39 | + return recentWeight[0].weight; | ||
40 | +} | ||
41 | + | ||
42 | +export function get_last_update(){ | ||
43 | + let recent = realm.objects('Waste').max('date'); | ||
44 | + let recentWeight = wastes.filtered('date = %0', recent); | ||
45 | + console.log(recentWeight[0].weight) | ||
65 | return recentWeight[0].weight; | 46 | return recentWeight[0].weight; |
66 | } | 47 | } |
67 | 48 | ||
... | @@ -70,23 +51,49 @@ export function get_recent_date(){ | ... | @@ -70,23 +51,49 @@ export function get_recent_date(){ |
70 | return realm.objects('Waste').max("date"); | 51 | return realm.objects('Waste').max("date"); |
71 | } | 52 | } |
72 | 53 | ||
73 | -export function get_today_data(today){ | 54 | +// export function get_today_data(today){ |
74 | - let wastes = realm.objects('Waste'); | 55 | +// let wastes = realm.objects('Waste'); |
56 | +// var list = []; | ||
57 | +// for(var i =0; i<wastes.length; i++){ | ||
58 | +// if(get_date(wastes[i].date) == get_date(today)){ | ||
59 | +// temp = [waste[i].date, waste[i].diff, waste[i].weight] | ||
60 | +// list.append(temp); | ||
61 | +// } | ||
62 | +// } | ||
63 | +// return list; | ||
64 | +// } | ||
65 | + | ||
66 | +export function get_today_data(){ | ||
67 | + var today_start = get_today_start(); | ||
68 | + console.log("today_start: ",today_start) | ||
69 | + let wastes = realm.objects('Waste').filtered('date >= $0',today_start); | ||
75 | var list = []; | 70 | var list = []; |
76 | - for(var i =0; i<wastes.length; i++){ | 71 | + for(var i = 0; i < wastes.length; i++){ |
77 | - if(get_date(wastes[i].date) == get_date(today)){ | 72 | + var save_time = new Date(wastes[i].date); |
78 | - temp = [waste[i].date, waste[i].diff, waste[i].weight] | 73 | + var temp = [save_time.getHours()+":"+save_time.getMinutes()+":"+save_time.getSeconds(), wastes[i].diff, wastes[i].weight+"g"] |
79 | - list.append(temp); | 74 | + list.push(temp); |
80 | - } | ||
81 | } | 75 | } |
76 | + console.log(list); | ||
77 | + console.log("count:", wastes.length) | ||
82 | return list; | 78 | return list; |
83 | } | 79 | } |
84 | 80 | ||
85 | export function delete_all_data(today){ | 81 | export function delete_all_data(today){ |
86 | let all_wastes = realm.objects('Waste'); | 82 | let all_wastes = realm.objects('Waste'); |
83 | + realm.write(() => { | ||
87 | realm.delete(all_wastes); | 84 | realm.delete(all_wastes); |
85 | + }) | ||
86 | + var wastes = realm.objects('Waste') | ||
87 | + console.log("delete, count: ", wastes.length) | ||
88 | } | 88 | } |
89 | 89 | ||
90 | -var get_date = function (date){ | 90 | +function get_today_start(){ |
91 | - return pad(date.getFullyear(),4)+pad(date.getMonth()+1, 2)+ pad(date.getDate(), 2) | 91 | + var today = new Date(); |
92 | + var dd = today. getDate(); | ||
93 | + var mm = today.getMonth(); | ||
94 | + var yyyy = today. getFullYear(); | ||
95 | + | ||
96 | + var togettime = new Date(2019,11,13).getTime(); | ||
97 | + console.log(togettime) | ||
98 | + return togettime; | ||
92 | } | 99 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -6,10 +6,10 @@ import * as d3 from 'd3' | ... | @@ -6,10 +6,10 @@ import * as d3 from 'd3' |
6 | // import Showkg from './ShowKg' | 6 | // import Showkg from './ShowKg' |
7 | 7 | ||
8 | const GRAPH_MARGIN = 20 | 8 | const GRAPH_MARGIN = 20 |
9 | -const GRAPH_BAR_WIDTH = 5 | 9 | +const GRAPH_BAR_WIDTH = 10 |
10 | const colors = { | 10 | const colors = { |
11 | axis: '#E4E4E4', | 11 | axis: '#E4E4E4', |
12 | - bars: '#15AD13', | 12 | + bars: '#0066cc', |
13 | bardefult: '#CED4DA' | 13 | bardefult: '#CED4DA' |
14 | } | 14 | } |
15 | 15 | ||
... | @@ -40,7 +40,7 @@ export default class HistoryGraph extends PureComponent { | ... | @@ -40,7 +40,7 @@ export default class HistoryGraph extends PureComponent { |
40 | render() { | 40 | render() { |
41 | // Dimensions | 41 | // Dimensions |
42 | const SVGHeight = 300 | 42 | const SVGHeight = 300 |
43 | - const SVGWidth = 300 | 43 | + const SVGWidth = 450 |
44 | const graphHeight = SVGHeight - 2 * GRAPH_MARGIN | 44 | const graphHeight = SVGHeight - 2 * GRAPH_MARGIN |
45 | const graphWidth = SVGWidth - 2 * GRAPH_MARGIN | 45 | const graphWidth = SVGWidth - 2 * GRAPH_MARGIN |
46 | const data = this.props.data | 46 | const data = this.props.data |
... | @@ -74,7 +74,7 @@ export default class HistoryGraph extends PureComponent { | ... | @@ -74,7 +74,7 @@ export default class HistoryGraph extends PureComponent { |
74 | x={graphWidth} | 74 | x={graphWidth} |
75 | textAnchor="end" | 75 | textAnchor="end" |
76 | y={y(topValue) * -1 - 5} | 76 | y={y(topValue) * -1 - 5} |
77 | - fontSize={12} | 77 | + fontSize={15} |
78 | fill="black" | 78 | fill="black" |
79 | fillOpacity={0.4}> | 79 | fillOpacity={0.4}> |
80 | {topValue + ' ' + this.props.unit} | 80 | {topValue + ' ' + this.props.unit} |
... | @@ -130,15 +130,26 @@ export default class HistoryGraph extends PureComponent { | ... | @@ -130,15 +130,26 @@ export default class HistoryGraph extends PureComponent { |
130 | {data.map(item => ( | 130 | {data.map(item => ( |
131 | <SvgText | 131 | <SvgText |
132 | key={'label' + item.label} | 132 | key={'label' + item.label} |
133 | - fontSize="8" | 133 | + fontSize="12" |
134 | x={x(item.label)} | 134 | x={x(item.label)} |
135 | y="10" | 135 | y="10" |
136 | textAnchor="middle">{item.label}</SvgText> | 136 | textAnchor="middle">{item.label}</SvgText> |
137 | ))} | 137 | ))} |
138 | </G> | 138 | </G> |
139 | </Svg> | 139 | </Svg> |
140 | + <View style={style.container}> | ||
140 | <Text>{this.state.kg}</Text> | 141 | <Text>{this.state.kg}</Text> |
141 | </View> | 142 | </View> |
143 | + </View> | ||
142 | ) | 144 | ) |
143 | } | 145 | } |
144 | } | 146 | } |
147 | + | ||
148 | +const style = StyleSheet.create({ | ||
149 | + container: { | ||
150 | + flex : 8.8, | ||
151 | + backgroundColor:"rgba(230,230,230,0.5)", | ||
152 | + justifyContent : 'center', | ||
153 | + padding : 25, | ||
154 | + } | ||
155 | +}); | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment