You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"If all the values are associations, we convert it to DataSeries the same way as the array of associations is converted to dictionary with asDictionary"
7
-
selfdetect: [ :x |
8
-
(x class=Association) not ]
9
-
ifNone: [ | keys values |
10
-
keys :=selfcollect: [ :assoc |
11
-
assoc key ].
12
-
values :=selfcollect: [ :assoc |
13
-
assoc value ].
14
-
15
-
series := values asDataSeries.
16
-
series keys: keys.
17
-
^ series ].
6
+
allInstancesOf := [ :aClass |
7
+
selfdetect: [ :x |
8
+
(x isKindOf: aClass) not ]
9
+
ifFound: [ false ]
10
+
ifNone: [ true ] ].
18
11
19
-
self
20
-
detect: [ :x | x isNumber not ]
21
-
ifFound: [ seriesClass :=DataSeries ]
22
-
ifNone: [ seriesClass :=DataSeriesNumeric ].
12
+
(allInstancesOf value:Number) ifTrue: [
13
+
^DataSeriesNumericnewFrom:self ].
23
14
24
-
series := seriesClass new: self size.
25
-
26
-
selfdoWithIndex: [:each:i | series at: i put: each].
27
-
^ series
15
+
(allInstancesOf value:String) ifTrue: [
16
+
"Can we convert it to DataSeriesTime?"
17
+
[ ^DataSeriesTimenewFrom:self ]
18
+
on:Errordo: [ "nothing" ] ].
19
+
20
+
"Either everything is a String, or none of the above is satisfied. In any case, we convert everything to String"
0 commit comments