In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Using Power BI to realize the visualization of real-time data is a topic of concern. The display of push data on the dashboard can be used in scenarios such as a large command screen.
The actual combat content of this video is as follows: https://v.qq.com/x/page/y3030euh7do.html
First, take a look at the effect. The curve in the following figure will be automatically refreshed:
The steps are as follows:
Create a stream dataset and select API mode
Among them, Azure stream analysis, as of December 2019, Azure flow analysis in China does not support writing the output directly to Power BI.
Fill in the dataset name and value and value type and open historical data analysis:
Among them, historical data analysis is used to store data temporarily, and the temporary data can present a curve.
Create a dashboard and add a real-time data patch to the dashboard
4. Select the stream data set that has been created
5. Add a custom streaming data tile to the dashboard page
Visual effect selection line chart
Axis selection time
Temperature and humidity added as "value"
6. The data can be pushed to the dataset by invoking the Post request with the information shown below
A result of 200 sent by Postman indicates that the execution is successful.
7. To create a report on a dataset, you can view the results of using POST requests to push to the streaming dataset
8. The sample code for calling is as follows:
Using Newtonsoft.Json;using System;using System.IO;using System.Net;using System.Text;using System.Threading.Tasks;namespace pushdatatopowerbidataset {class Program {private static int s_telemetryInterval = 1; / / Seconds private static string PowerBIPushDataUrl = "https://api.powerbi.cn/beta/729c6bf9-debe-4b7f-b56a-5fb0c70c9a80/datasets/fc445a3c-9a25-4298-8188-89112874e5c3/rows?key=seAORXugMKybekrdRAxfSWM5o1MS%2F9d4pcPF9zAgblivdNXz9pRivqyVwAS%2FXMoo8wA01vuAu%2B2hBHI8gdAWMg%3D%3D"; Private static void Main (string [] args) {Console.WriteLine ("Send realtime data to power bi dataset by api. Ctrl-C to exit.\ n "); SendMessageToPbiDataSetAsync (); Console.ReadLine ();} private static async void SendMessageToPbiDataSetAsync () {while (true) {/ / Initial telemetry values double minTemperature = 20; double minHumidity = 60; Random rand = new Random () Double currentTemperature = minTemperature + rand.NextDouble () * 15; double currentHumidity = minHumidity + rand.NextDouble () * 20; / / Create JSON message var telemetryDataPoint = new {temperature = currentTemperature, humidity = currentHumidity, time=DateTime.Now} Var messageString = JsonConvert.SerializeObject (telemetryDataPoint); PostUrlAsync (PowerBIPushDataUrl, messageString); await Task.Delay (s_telemetryInterval * 1000);}} public static string PostUrlAsync (string url, string postData) {string result = ""; HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url); req.Method = "POST" Req.Timeout = 8000ram / set request timeout in milliseconds req.ContentType = "application/json"; byte [] data = Encoding.UTF8.GetBytes ("[" + postData+ "]"); req.ContentLength = data.Length; using (Stream reqStream = req.GetRequestStream ()) {reqStream.Write (data, 0, data.Length) ReqStream.Close ();} HttpWebResponse resp = (HttpWebResponse) req.GetResponse (); Stream stream = resp.GetResponseStream (); / / get response content if (resp.StatusCode==HttpStatusCode.OK) {Console.WriteLine ("OK" + "" + postData);} return result }}}
At this point, you can see the visualization of real-time refresh on the dashboard:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.