Vega-Lite Visualization interpreting dates from Google Sheet as long numbers - google-sheets

Pulling data into Google Data Studio from a Google Sheet with dates stored in yyyy-mm-dd format. The dates look correct and calculate correctly with formulas and adjustments everywhere except in a Gantt chart using the Vega-Lite Community Visualization, which shows the date in a long-number format (e.g. 20210520), and is unable to display the data when using "type": "temporal" or using "timeUnit": "utcyearmonthdatehours".
I've ran various tests, including...
Changing the date format for the date columns to plain text, yyyyddmm, yymmdd, yyyy/mm/dd formats.
Replace the current date columns with new columns using the alternate formats in point 1 (above).
Changing the date field formats directly in Google Data Studio to the formats in point 1 (above).
Creating a secondary set of date columns in plain-text using an Arrayformula and Text() function to reformat the actual dates to plain-text.
So far, options 2 & 4 are the only way I've been able to get the gantt to render correctly, reading the data in date format. But option 2 renders the other charts in GDS as unusable, as the other charts cannot translate the plain-text to usable dates.
Option 4 does work, but isn't the ideal route, given the redundant data. I'd prefer to have just 1 column for the Start Date and another for the End Date, rather than 2 columns for both. Feels like I may be missing something obvious here. Is there a way to either properly format the dates in Google Sheets to work properly with both the GDS date fields and Vega-Lite, or is there a way to properly parse the date data in Vega-Lite without needing to use a second set of plain-text columns?
Report replicating the issue: Project Tracking (debug report)
Edit: below is the code for the Vega-lite visualizations using the date fields from Google Sheets, which Vega-lite is not interpreting as dates.
Without timeunit or temporal field type:
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "A bar chart with highlighting on hover and selecting on click. (Inspired by Tableau's interaction style.)",
"config": {
"background": null,
"view": {
"stroke": "transparent"
}
},
"layer": [
{
"layer": [
{
"params": [
{
"name": "grid",
"select": "interval",
"bind": "scales"
}
],
"mark": {
"type": "bar",
"cursor": "pointer",
"tooltip": true,
"point": true,
"cornerRadiusEnd": 5,
"opacity": 0.8
},
"encoding": {
"color": {
"field": "$dimension3",
"title": "$dimension3.name"
}
}
}
],
"encoding": {
"x": {
"field": "$dimension0",
"axis": {
"title": null,
"grid": true
}
},
"y": {
"field": "$dimension1",
"title": "$dimension1.name",
"type": "nominal",
"sort": "x",
"axis": {
"title": null,
"grid": true,
"tickBand": "extent"
}
},
"x2": {
"field": "$dimension2"
},
"yOffset": {
"field": "$dimension3"
}
}
}
]
}
With timeunit and field type temporal:
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "A bar chart with highlighting on hover and selecting on click. (Inspired by Tableau's interaction style.)",
"config": {
"background": null,
"view": {
"stroke": "transparent"
}
},
"layer": [
{
"layer": [
{
"params": [
{
"name": "grid",
"select": "interval",
"bind": "scales"
}
],
"mark": {
"type": "bar",
"cursor": "pointer",
"tooltip": true,
"point": true,
"cornerRadiusEnd": 5,
"opacity": 0.8
},
"encoding": {
"color": {
"field": "$dimension3",
"title": "$dimension3.name"
}
}
}
],
"encoding": {
"x": {
"field": "$dimension0",
"type": "temporal",
"timeUnit": "utcyearmonthdatehours",
"axis": {
"title": null,
"grid": true
}
},
"y": {
"field": "$dimension1",
"title": "$dimension1.name",
"type": "nominal",
"sort": "x",
"axis": {
"title": null,
"grid": true,
"tickBand": "extent"
}
},
"x2": {
"field": "$dimension2"
},
"yOffset": {
"field": "$dimension3"
}
}
}
]
}

Related

Filter by Array Length in OData

I want to filter based on the length of data. For example, I want to retrieve only the images array that contains more than 1 element. Something like that images.length > 6.
Is this possible using OData. Your help is much appreciated
{
"#search.score": 1,
"site": "core",
"images": [
{
"alt": "Quad"
}
]
}, ,{
"#search.score": 1,
"site": "ccc",
"images": [
{
"alt": "some"
}
]
},
{
"#search.score": 1,
"site": "ccc",
"images": [
{
"alt": "DePaul's Student Center"
},
{
"alt": "O'Malley"
},
{
"alt": "Campus"
},
{
"alt": " Campus"
},
{
"alt": "ith students"
},
{
"alt": "er"
},
{
"alt": "df"
},
{
"alt": "sdf"
},
{
"alt": "df"
},
]
A simpler and better solution is to populate your data with an additional property called ImageCount. If you submit your items via the Azure Search SDK, you can process them before submitting them to search. Add the image count to each item and then filter like normal.
$filter=ImageCount gt 6

Analytics Widget in Azure devops server 2019 - looking for Rest Api and class libraby for analytics Widget

I'm working on creating set of widgets for dashboard via code using
REST api https://learn.microsoft.com/en-us/rest/api/azure/devops/dashboard/widgets/create?view=azure-devops-server-rest-5.0
So, I was able to create the widgets programatically but struggling while configuring the widget to point to certain team and details.
Example: creating Burndown widget using Analytics extention (https://marketplace.visualstudio.com/items?itemName=ms.vss-analytics&ssr=false#overview).
I was able to create widget with contributionId and details.
However, can't set the settings to do aggregation of story points over certain sprints.
Any help regarding this is appreciated.
Here is the json passed in Create request. Need help on "settings" part.
{
"id": "",
"eTag": "7",
"name": "Burndown",
"position": {
"row": 1,
"column": 4
},
"size": {
"rowSpan": 2,
"columnSpan": 3
},
"settings": "",
"settingsVersion": {
"major": 1,
"minor": 0,
"patch": 0
},
"artifactId": "",
"url": "urlvalue",
"_links": {
"self": {
"href": "urlvalue"
},
"group": {
"href": "urlvalue"
},
"dashboard": {
"href": "urlvalue"
}
},
"isEnabled": true,
"contentUri": null,
"contributionId": "ms.vss-dashboards-web.Microsoft.VisualStudioOnline.Dashboards.BurndownWidget",
"typeId": "Microsoft.VisualStudioOnline.Dashboards.BurndownWidget",
"configurationContributionId": "ms.vss-dashboards-web.Microsoft.VisualStudioOnline.Dashboards.BurndownWidget.Configuration",
"configurationContributionRelativeId": "Microsoft.VisualStudioOnline.Dashboards.BurndownWidget.Configuration",
"isNameConfigurable": true,
"loadingImageUrl": "urlvalue",
"lightboxOptions": {
"width": 900,
"height": 700,
"resizable": true
}
}
Below are two samples about the settings parts.
1.Set the certain date as the end date.
"settings":"{
\"teams\":[{
\"projectId\":\"projectId\",
\"teamId\":\"teamId\"
}],
\"aggregation\":{
\"identifier\":0,
\"settings\":\"\"
},
\"completedWorkEnabled\":false,
\"fieldFilters\":[],
\"stackByWorkItemTypeEnabled\":false,
\"burndownTrendlineEnabled\":true,
\"workItemTypeFilter\":{
\"identifier\":\"BacklogCategory\",
\"settings\":\"Microsoft.RequirementCategory\"
},
\"includeBugsForRequirementCategory\":false,
\"timePeriodConfiguration\":{
\"startDate\":\"2019-10-14\",
\"samplingConfiguration\":{
\"identifier\":0,
\"settings\":{
\"endDate\":\"2019-10-15\",
\"lastDayOfWeek\":5,
\"sampleInterval\":0
}
}
},
\"totalScopeTrendlineEnabled\":true
}",
2. Set the certain Iteration as the end date.
"settings":"{
\"teams\":[{
\"projectId\":\"projectId\",
\"teamId\":\"teamId\"
}],
\"aggregation\":{
\"identifier\":0,
\"settings\":\"\"
}
\"completedWorkEnabled\":false,
\"fieldFilters\":[],
\"stackByWorkItemTypeEnabled\":false,
\"burndownTrendlineEnabled\":true,
\"workItemTypeFilter\":{
\"identifier\":\"BacklogCategory\",
\"settings\":\"Microsoft.RequirementCategory\"
},
\"includeBugsForRequirementCategory\":false,
\"timePeriodConfiguration\":{
\"startDate\":\"2019-10-14\",
\"samplingConfiguration\":{
\"identifier\":1,
\"settings\":[
\"iterationId\"
]
}
},
\"totalScopeTrendlineEnabled\":true
}",

Highcharts line chart - incorrect point ordering - boost module

Issue
We are currently implementing a highcharts graph for large datasets that will require the boost module for performance reasons. However, on enabling the boost module we have encountered an intermittent issue that is proving challenging to consistently reproduce and isolate.
Because I am not able to replicate this I cannot create a jsfiddle as of yet. Does anyone have any idea how to isolate and fix this?
The graph should look like this:
Expected graph
But occasionally does this:
Actual graph
This has also happened on another occasion whilst manually testing with different data:
With different data
It has been observed on
Chrome 70.0.3538.67
IE 11.345.17134.0
Highcharts JS & Boost module v6.1.4
Input data
Sample of the type of data:
{
"label": "2018-04-19T15:17:02",
"value": "1"
}, {
"label": "2018-04-19T15:17:05",
"value": "9620035.36877074"
}, {
"label": "2018-04-19T15:17:59",
"value": "9583104.14689662"
}, {
"label": "2018-04-19T15:18:46",
"value": "9604094.84064805"
}, {
"label": "2018-04-19T15:20:17",
"value": "9571679.9536289"
}, {
"label": "2018-04-20T08:18:24",
"value": "7902991.39771514"
}
Or:
{
"label": "2018-04-19T15:17:59",
"value": "1.4132e-007"
}, {
"label": "2018-04-19T15:18:46",
"value": "1.41434e-007"
}, {
"label": "2018-04-19T15:20:17",
"value": "1.41355e-007"
}, {
"label": "2018-04-20T08:18:24",
"value": "1.40532e-007"
}, {
"label": "2018-04-20T08:20:35",
"value": "1.40928e-007"
}, {
"label": "2018-04-20T08:23:51",
"value": "1.4078e-007"
}, {
"label": "2018-04-20T08:24:39",
"value": "1.40901e-007"
}
Graph config
{
"chart": {
"type": "line",
"zoomType": "x",
"panning": true,
"panKey": "shift"
},
"boost": {
"usePreallocated": false
},
...
y-axis label customisation
title
exporting
etc
...
"series": [{
"showInLegend": false,
"name": "",
"data": []
}],
}
Update mechanism
When the HTTP response comes back the following is called on the graph instance:
graphToUpdate.series[0].setData(parsedData, true, true, false);

CEP generate Measurement/Event not in UTC time but in Local

All Measurements came with a time-stamp (event time) of when the measurement was created. Some of these measurements are artificial ones, meaning that they are not created by the device itself, but by a CEP rule running inside the CoT.
The "normal" measurements have the time format coded as UTC
[{
"id": "12704547",
"data": {
"data": {
"time": "2016-07-25T15:24:11.000Z",
"id": "1152930",
"self": "http://testTenant.c8y.com/measurement/measurements/1152930",
"source": {
"id": "222812",
"self": "http://testTenant.c8y.com/inventory/managedObjects/222812"
},
"type": "tsystems_cumulocity_energymeter_digital_ping",
"Energieverbrauch": {
"Ping": {
"unit": "Wh",
"value": 1
}
}
},
"realtimeAction": "CREATE"
},
"channel": "/measurements/222812"
}, {
"successful": true,
"channel": "/meta/connect"
}]
But the "artificial" measurements (created by the CEP rule) use a timestamp with local time
[{
"id": "12704578",
"data": {
"data": {
"time": "2016-07-25T17:24:00.952+02:00",
"id": "1152931",
"self": "http://testTenant.c8y.com/measurement/measurements/1152931",
"source": {
"id": "222812",
"self": "http://testTenant.c8y.com/inventory/managedObjects/222812"
},
"type": "tsystems_cumulocity_energymeter_power_consumption",
"Leistung": {
"Aggregation_1min": {
"unit": "W",
"value": 900
}
}
},
"realtimeAction": "CREATE"
},
"channel": "/measurements/222812"
}]
The measurements from one device should always be encoded with the same timezone (UTC preferred) as different timezone can create problems in clients using that data.
I create the 'time' in the CEP with
current_timestamp().toDate() as time
please use:
com.cumulocity.model.util.DateTimeUtils.newUTC(current_timestamp().toDate()) as dateTime,
instead of
current_timestamp().toDate() as time
in your cep rule.
Best regards,
Arkadiusz
Cumulocity Support Team

Highchart Stacked Column w/ Datetime X-axis Columns Too Thin

I am trying to display to my users the number of videos recorded per day with each one of their cameras. To do so I would like to use a stacked back (each stack showing the # of videos recorded with a given camera). Here are the options I am passing in:
var options = {
"title": {
"text": null
},
"legend": {
"layout": "vertical",
"style": { },
"enabled": false
},
"xAxis": {
"type": "datetime",
"minTickInterval": 86400000
},
"yAxis": {
"stackLabels": { "enabled": true },
"title": { "text": null }
},
"tooltip": { "enabled": true },
"credits": { "enabled": false },
"plotOptions": {
"column": { "stacking": "normal" }
},
"chart": {
"defaultSeriesType": "column",
"height": 200,
"borderRadius": 0,
"renderTo": "monthy_chart"
},
"subtitle": { },
"colors": [ "#c7084b","#089fbf","#00d047","#d300d1","#f48400","#f6f400" ],
"series": [
{
"name": "Camera",
"data": [ [ 1362614400000,6 ],[ 1362528000000,2 ] ]
},
{
"name": "NewCamera2",
"data": [ [ 1362614400000,1 ] ]
}
]
};
The graph displays the data correctly but is rendering the columns extremely narrowly even when there are only 2 days of data (image below). Is there a way for me to deine the scale of the x-axis so the widths of the columns will display a bit better?
http://i.stack.imgur.com/NSSYg.png
You can set pointWidth and startOnTick / endOfTick
http://jsfiddle.net/bLrah/
"xAxis": {
startOnTick:true,
endOnTick:true,
"type": "datetime",
"minTickInterval": 86400000
http://api.highcharts.com/highcharts#xAxis.startOnTick
http://api.highcharts.com/highcharts#xAxis.endOnTick
http://api.highcharts.com/highcharts#plotOptions.column.pointWidth

Resources