public string GetHtml() { var html = string.Empty; var chartQueryPieChartData = new Dictionary <string, long>(); var chartQueryResultsLocal = Database.GetInstance().GetActivityPieChartData(_date); // merge with remote data if necessary chartQueryPieChartData = RemoteDataHandler.VisualizeWithRemoteData() ? RemoteDataHandler.MergeActivityData(chartQueryResultsLocal, Database.GetInstanceRemote().GetActivityPieChartData(_date)) : chartQueryResultsLocal; if (chartQueryPieChartData.Count == 0) { html += VisHelper.NotEnoughData(Dict.NotEnoughDataMiniSurvey); return(html); } var chartUrl = PreparePieChartUrl(chartQueryPieChartData); var totalHoursWorked = Database.GetInstance().GetTotalHoursWorked(_date); html += VisHelper.ChartTitle("Distribution of the Activity on your Computer"); html += "<p style='text-align: center;'>Total hours worked on your computer: <strong>" + totalHoursWorked + "</strong>.</p>"; html += string.IsNullOrEmpty(chartUrl) ? VisHelper.NotEnoughData() : "<p style='text-align: center;'><img src='" + chartUrl + "'/></p>"; return(html); }
public string GetHtml() { var html = String.Empty; var productivityGaugeData = new List <ProductivityTimeDto>(); // fetch data sets var productivityGaugeDataLocal = Database.GetInstance().GetUserProductivityData(_date, false); // merge with remote data if necessary productivityGaugeData = RemoteDataHandler.VisualizeWithRemoteData() ? RemoteDataHandler.MergeProductivityData(productivityGaugeDataLocal, Database.GetInstanceRemote().GetUserProductivityData(_date, false)) : productivityGaugeDataLocal; html += VisHelper.ChartTitle("Your Perceived Productivity"); if (productivityGaugeData.Count == 0) { html += VisHelper.NotEnoughData(Dict.NotEnoughDataMiniSurvey); return(html); } // Calculate Productivityvalue var productivityValue = CalculateWeightedProductivityValue(productivityGaugeData); ///////////////////// // Some strings for the attributes ///////////////////// const string gaugeChartName = "gaugeChartName"; const int height = 100; ///////////////////// // CSS ///////////////////// html += "<style type='text/css'>"; html += ".c3-gauge-value { fill: white; visibility:hidden; }"; // hack to hide the gauge value html += "</style>"; ///////////////////// // HTML ///////////////////// //html += "<p style='text-align: center;'>Average productivity based on your manual selection in the mini-surveys<br />(1 = very unproductive, 7 = very productive).</p>"; html += "<div id='" + gaugeChartName + "' align='center'></div>"; ///////////////////// // JS ///////////////////// var productivityValueString = Math.Round(productivityValue, 1).ToString().Replace(',', '.'); var data = "columns: [ ['PerceivedProductivity', " + productivityValueString + "] ], type: 'gauge'"; const string gauge = " label : { show: false }, min: 1, max: 7, width: 36"; const string color = "pattern: ['#FF0000', '#F97600', '#F6C600', '#60B044'], threshold: { unit: 'value', max: 7, values: [1, 2, 4, 6] }"; var size = "height: " + height; var parameters = " bindto: '#" + gaugeChartName + "', data: { " + data + " }, gauge: { " + gauge + " }, color: { " + color + " }, size: { " + size + " }"; html += "<script type='text/javascript'>"; html += "var " + gaugeChartName + " = c3.generate({ " + parameters + " });"; html += "</script>"; return(html); }
public string GetHtml() { // calculate maxWidth // TODO: do later // produce visualizations (html) var html = string.Empty; html += VisHelper.ChartTitle("Timeline of your Context, User Input and Perceived Productivity"); html += CreateContextGantTimeline(); html += CreateUserInputLineGraph(); html += CreateProdTasksLineGraph(); return(html); }