@@ -8,7 +8,9 @@ class ChannelMetadata(object):
88 Attributes
99 ----------
1010 name : str
11+ The name of the encoding channel
1112 data : np.array
13+ The data linked to the channel (temporal data is converted)
1214 axis : dict
1315 bin : boolean, None
1416 field : str
@@ -20,16 +22,17 @@ class ChannelMetadata(object):
2022 type : str
2123 """
2224 def __init__ (self , channel , alt_chart ):
23- self .name = channel # Not from Altair
24- self .data = self ._locate_channel_data (alt_chart ) # Not from Altair
25- self .axis = alt_chart .to_dict ()['encoding' ][self .name ].get ('axis' , {})
26- self .bin = alt_chart .to_dict ()['encoding' ][self .name ].get ('bin' , None )
27- self .field = alt_chart .to_dict ()['encoding' ][self .name ].get ('field' , None )
28- self .scale = alt_chart .to_dict ()['encoding' ][self .name ].get ('scale' , {})
29- self .sort = alt_chart .to_dict ()['encoding' ][self .name ].get ('sort' , None )
30- self .stack = alt_chart .to_dict ()['encoding' ][self .name ].get ('stack' , None )
31- self .timeUnit = alt_chart .to_dict ()['encoding' ][self .name ].get ('aggregate' , None )
32- self .title = alt_chart .to_dict ()['encoding' ][self .name ].get ('title' , None )
25+ chart_dict = alt_chart .to_dict ()
26+ self .name = channel
27+ self .data = self ._locate_channel_data (alt_chart )
28+ self .axis = chart_dict ['encoding' ][self .name ].get ('axis' , {})
29+ self .bin = chart_dict ['encoding' ][self .name ].get ('bin' , None )
30+ self .field = chart_dict ['encoding' ][self .name ].get ('field' , None )
31+ self .scale = chart_dict ['encoding' ][self .name ].get ('scale' , {})
32+ self .sort = chart_dict ['encoding' ][self .name ].get ('sort' , None )
33+ self .stack = chart_dict ['encoding' ][self .name ].get ('stack' , None )
34+ self .timeUnit = chart_dict ['encoding' ][self .name ].get ('aggregate' , None )
35+ self .title = chart_dict ['encoding' ][self .name ].get ('title' , None )
3336 self .type = self ._locate_channel_dtype (alt_chart )
3437
3538 if self .type == 'temporal' :
@@ -67,6 +70,7 @@ def _locate_channel_data(self, alt_chart):
6770
6871 def _locate_channel_dtype (self , alt_chart ):
6972 """Locates dtype used for each channel
73+
7074 Parameters
7175 ----------
7276 alt_chart : altair.Chart
0 commit comments