|
@@ -2,7 +2,7 @@ import { StatusBar } from 'expo-status-bar';
|
2
|
2
|
import React, {useState, useEffect} from 'react';
|
3
|
3
|
import { View, Image, StyleSheet, Text, Button, ScrollView, Pressable} from 'react-native';
|
4
|
4
|
import DropDownPicker from 'react-native-dropdown-picker';
|
5
|
|
-import { parse } from 'json2csv';
|
|
5
|
+
|
6
|
6
|
|
7
|
7
|
//import JSON;
|
8
|
8
|
//import { Dataframe, readJSON } from "danfojs";
|
|
@@ -19,20 +19,41 @@ var information = "data goes here"
|
19
|
19
|
|
20
|
20
|
function organize(){
|
21
|
21
|
|
22
|
|
- var stringDiv = JSON.parse(information)
|
23
|
|
- var csv = parse(stringDiv)
|
24
|
|
- console.log(csv)
|
|
22
|
+ var stringDiv = JSON.stringify(information)
|
|
23
|
+ stringDiv = stringDiv.replace('[[', '');
|
|
24
|
+ stringDiv = stringDiv.replace(']]', '');
|
|
25
|
+ stringDiv = stringDiv.split(',')
|
|
26
|
+ //create smaller array variables
|
|
27
|
+ let variables = []
|
|
28
|
+ let value = []
|
|
29
|
+ let est = []
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+ //theres a better way to do this but im not fixing it rn
|
|
33
|
+ for(let i = 0; i<stringDiv.length; i++){
|
|
34
|
+ if(i<stringDiv.length/3)
|
|
35
|
+ {variables.push(stringDiv[i])}
|
|
36
|
+ else if(i<stringDiv.length/3*2)
|
|
37
|
+ {value.push(stringDiv[i])}
|
|
38
|
+ else{est.push(stringDiv[i])}
|
|
39
|
+ }
|
|
40
|
+
|
|
41
|
+ //anyways this to format it
|
25
|
42
|
|
26
|
|
- //var csv is the variable with the thing you just pulled
|
27
|
|
- //put function and data cleaning here
|
28
|
|
- //just make sure you change the return value in 'getInfo()'
|
29
|
|
- //so it returns the actual organized table
|
30
|
|
- //or make getInfo() organize the table as well
|
31
|
|
- //and return that organized table
|
32
|
|
- //i leave this to you
|
|
43
|
+ console.log("vars:",variables)
|
|
44
|
+ console.log("val:",value)
|
|
45
|
+ console.log("est:",est)
|
|
46
|
+ //organizedData = JSON.parse(information)
|
|
47
|
+ //console.log(stringDiv)
|
33
|
48
|
|
34
|
49
|
}
|
35
|
50
|
|
|
51
|
+function json_2_csv(information){
|
|
52
|
+ const csv = parse(obj);
|
|
53
|
+
|
|
54
|
+ console.log(csv);
|
|
55
|
+}
|
|
56
|
+
|
36
|
57
|
//fix
|
37
|
58
|
|
38
|
59
|
DropDownPicker.setListMode("SCROLLVIEW")
|
|
@@ -97,12 +118,12 @@ const styles = StyleSheet.create({
|
97
|
118
|
borderColor: "grey",
|
98
|
119
|
borderRadius: 8,
|
99
|
120
|
padding: (30, 16),
|
100
|
|
- backgroundColor: "#008CBA",
|
|
121
|
+ backgroundColor: "black",
|
101
|
122
|
marginTop: 0
|
102
|
123
|
},
|
103
|
124
|
buttonContainer: {
|
104
|
125
|
flexDirection: 'column',
|
105
|
|
- backgroundColor: 'black',
|
|
126
|
+ backgroundColor: '#f0f8ff',
|
106
|
127
|
alignItems: 'center',
|
107
|
128
|
justifyContent: 'center',
|
108
|
129
|
paddingTop:100,
|
|
@@ -111,7 +132,7 @@ const styles = StyleSheet.create({
|
111
|
132
|
container: {
|
112
|
133
|
flexDirection: 'column',
|
113
|
134
|
justifyContent: 'center',
|
114
|
|
- backgroundColor: 'black',
|
|
135
|
+ backgroundColor: '#f0f8ff',
|
115
|
136
|
alignItems: 'center',
|
116
|
137
|
justifyContent: 'center',
|
117
|
138
|
paddingTop:20,
|
|
@@ -119,23 +140,23 @@ const styles = StyleSheet.create({
|
119
|
140
|
},
|
120
|
141
|
containerbackground:{
|
121
|
142
|
|
122
|
|
- backgroundColor: '#063970'
|
|
143
|
+ backgroundColor: '#f0f8ff'
|
123
|
144
|
},
|
124
|
145
|
intro: {
|
125
|
146
|
fontWeight: "bold",
|
126
|
|
- color:"#beb2c8",
|
|
147
|
+ color:"#black",
|
127
|
148
|
fontSize: 30,
|
128
|
149
|
},
|
129
|
150
|
|
130
|
151
|
sub: {
|
131
|
|
- color:"#beb2c8",
|
|
152
|
+ color:"#black",
|
132
|
153
|
fontWeight: "bold",
|
133
|
154
|
fontSize: 15,
|
134
|
155
|
paddingBottom:10,
|
135
|
156
|
},
|
136
|
157
|
|
137
|
158
|
Navsub: {
|
138
|
|
- color:"#beb2c8",
|
|
159
|
+ color:"#black",
|
139
|
160
|
fontWeight: "bold",
|
140
|
161
|
fontSize: 30,
|
141
|
162
|
paddingBottom:10,
|
|
@@ -164,6 +185,7 @@ const styles = StyleSheet.create({
|
164
|
185
|
});
|
165
|
186
|
|
166
|
187
|
|
|
188
|
+
|
167
|
189
|
//default button press
|
168
|
190
|
|
169
|
191
|
const handlePress = () => false
|
|
@@ -303,10 +325,6 @@ function Picker() {
|
303
|
325
|
{label: 'Yauco', value: '153'}
|
304
|
326
|
]);
|
305
|
327
|
|
306
|
|
- //add a thing here to select year to take info from
|
307
|
|
-
|
308
|
|
-
|
309
|
|
-//add a dropdown in here
|
310
|
328
|
|
311
|
329
|
return (
|
312
|
330
|
<View>
|
|
@@ -344,8 +362,6 @@ function Picker() {
|
344
|
362
|
searchPlaceholder="Busqueda..."
|
345
|
363
|
/>
|
346
|
364
|
|
347
|
|
-
|
348
|
|
-
|
349
|
365
|
</View>
|
350
|
366
|
);
|
351
|
367
|
}
|
|
@@ -359,21 +375,17 @@ class App extends React.Component {
|
359
|
375
|
//the text at the end of a page gets cut off if anyone knows how to fix that?
|
360
|
376
|
vars = {
|
361
|
377
|
welcome:
|
362
|
|
-
|
363
|
378
|
|
364
|
379
|
<View style = {styles.containerbackground}>
|
365
|
380
|
<ScrollView style={styles.scrollView}>
|
366
|
381
|
<View style = {styles.container}>
|
367
|
|
-
|
368
|
|
-
|
369
|
|
- <Text style={styles.intro}>BIENVENIDO!!!!</Text>
|
370
|
|
-
|
371
|
|
- <Image source={require('./Logo.jpeg')} />
|
|
382
|
+ <Text style={styles.intro}>Bienvenido!</Text>
|
372
|
383
|
</View>
|
373
|
384
|
<View style = {styles.container}>
|
374
|
|
- <Text style={styles.sub}>Aqui podra mantenerse al tanto con las
|
375
|
|
- ultimas noticias relacionadas al censo y tambien verificar
|
376
|
|
- las tablas por municipio.</Text>
|
|
385
|
+ <Text style={styles.sub}>Aquí podra mantenerse al tanto con las
|
|
386
|
+ últimas noticias relacionadas al Censo y tener acceso a los
|
|
387
|
+ los Demographic Data Profiles de cada municipio de
|
|
388
|
+ Puerto Rico.</Text>
|
377
|
389
|
</View>
|
378
|
390
|
</ScrollView>
|
379
|
391
|
</View>,
|
|
@@ -386,9 +398,6 @@ vars = {
|
386
|
398
|
<Text style={styles.intro}>Noticias</Text>
|
387
|
399
|
|
388
|
400
|
<Image source={require('./Logo.jpeg')} />
|
389
|
|
-
|
390
|
|
-
|
391
|
|
-
|
392
|
401
|
|
393
|
402
|
</View>
|
394
|
403
|
</ScrollView></View>,
|
|
@@ -398,12 +407,10 @@ vars = {
|
398
|
407
|
<ScrollView nestedScrollEnabled = {true} style={styles.scrollView}>
|
399
|
408
|
<View style = {styles.container}>
|
400
|
409
|
|
401
|
|
-
|
402
|
410
|
<Text style={styles.intro}>DATA VIEWING PROJECT</Text>
|
403
|
411
|
|
404
|
412
|
<Picker />
|
405
|
|
-
|
406
|
|
- <Image source={require('./testimg.gif')} />
|
|
413
|
+
|
407
|
414
|
|
408
|
415
|
<DataButton />
|
409
|
416
|
|
|
@@ -438,19 +445,16 @@ setNews = () => this.setState({ current: this.vars.newsView })
|
438
|
445
|
<View style = {styles.containerbackground}>
|
439
|
446
|
<View style = {styles.buttonContainer}>
|
440
|
447
|
<Text style={styles.Navsub}> Demographic Data Viewer</Text>
|
441
|
|
- <Text style={styles.sub}> Navegador</Text>
|
442
|
448
|
<View style = {styles.buttons}>
|
443
|
|
-
|
444
|
449
|
<Button
|
445
|
450
|
onPress = {this.setNews}
|
446
|
451
|
title = "Noticias"
|
447
|
|
- color = "rgba(255, 0, 0, 0)"
|
|
452
|
+ color = "white"
|
448
|
453
|
/>
|
449
|
|
-
|
450
|
454
|
<Button
|
451
|
455
|
onPress = {this.setData}
|
452
|
456
|
title = "Datos"
|
453
|
|
- color = "rgba(255, 0, 0, 0)"
|
|
457
|
+ color = "white"
|
454
|
458
|
/>
|
455
|
459
|
</View>
|
456
|
460
|
|