MCPcopy Create free account
hub / github.com/angular-rust/yew-components / create_stream

Function create_stream

src/linechart.rs:131–187  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

129}
130
131fn create_stream() -> DataStream<'static, &'static str, i32> {
132 let metadata = vec![
133 Channel {
134 name: "Series 1",
135 tag: 0,
136 visible: true,
137 },
138 Channel {
139 name: "Series 2",
140 tag: 1,
141 visible: true,
142 },
143 Channel {
144 name: "Series 3",
145 tag: 2,
146 visible: true,
147 },
148 ];
149
150 // Zero stream tag is allways metric
151 let mut frames = vec![DataFrame {
152 metric: "Monday",
153 data: [(0, 1), (1, 3), (2, 5)].iter().cloned().collect(),
154 }];
155
156 frames.push(DataFrame {
157 metric: "Tuesday",
158 data: [(0, 3), (1, 4), (2, 6)].iter().cloned().collect(),
159 });
160
161 frames.push(DataFrame {
162 metric: "Wednesday",
163 data: [(0, 4), (1, 3), (2, 1)].iter().cloned().collect(),
164 });
165
166 frames.push(DataFrame {
167 metric: "Thursday",
168 data: [(1, 5), (2, 1)].iter().cloned().collect(),
169 });
170
171 frames.push(DataFrame {
172 metric: "Friday",
173 data: [(0, 3), (1, 4), (2, 2)].iter().cloned().collect(),
174 });
175
176 frames.push(DataFrame {
177 metric: "Saturday",
178 data: [(0, 5), (1, 10), (2, 4)].iter().cloned().collect(),
179 });
180
181 frames.push(DataFrame {
182 metric: "Sunday",
183 data: [(0, 4), (1, 12), (2, 8)].iter().cloned().collect(),
184 });
185
186 DataStream::new(metadata, frames)
187}

Callers 1

renderedMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected