Extract the list of keys to use when stacking and coloring the bars.
(data: &Vec<impl PointDatum<T, U>>)
| 129 | |
| 130 | /// Extract the list of keys to use when stacking and coloring the bars. |
| 131 | fn extract_keys(data: &Vec<impl PointDatum<T, U>>) -> Vec<String> { |
| 132 | let mut keys = Vec::new(); |
| 133 | let mut map = HashMap::new(); |
| 134 | |
| 135 | for datum in data.iter() { |
| 136 | match map.insert(datum.get_key(), 0) { |
| 137 | Some(_) => {}, |
| 138 | None => keys.push(datum.get_key()), |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | keys |
| 143 | } |
| 144 | |
| 145 | } |
| 146 |