How to add data to a custom HighChart's HighMaps map? joinBy? - highcharts
I created a custom map using Inkscape as described on the HighMaps docs pages at: http://www.highcharts.com/docs/maps/custom-maps
Everything up to step 16 seems to go smoothly.
Step 16 says that the only remaining thing to do is to add data or use the MapData option and this is where I am struggling.
How does one link the custom shapes in the map to data points? Using the shape name in a JoinBy?
http://jsfiddle.net/GeertClaes/aWJ2D/
$(function () {
// Initiate the chart
$('#container').highcharts('Map', {
title:{text:''},
subTitle:{text:''},
credits:{enabled:false},
legend:{enabled: false},
series:
[
{
"type": "map",
"data": [
{
"name": "Status1-CurrentPeriod",
"path": "M0,-695,0,-682C1,-682,2,-683,3,-683,15,-683,25,-672,25,-658,25,-645,15,-634,3,-634,2,-634,1,-634,1,-634L1,-622,108,-622,107,-694,0,-695z"
},
{
"name": "Status1-Period-1",
"path": "M0,-684,1,-633C15,-635,26,-646,26,-658,26,-672,14,-682,0,-684z"
},
{
"name": "Status2-CurrentPeriod",
"path": "M178,-695,178,-682C179,-682,180,-683,181,-683,193,-683,203,-672,203,-658,203,-645,193,-634,181,-634,180,-634,180,-634,179,-634L179,-622,286,-622,285,-694,178,-695z"
},
{
"name": "Status2-Period-1",
"path": "M178,-684,179,-633C193,-635,204,-646,204,-658,204,-672,193,-682,178,-684z"
},
{
"name": "Status3-CurrentPeriod",
"path": "M357,-695,357,-682C358,-682,359,-683,360,-683,372,-683,382,-672,382,-658,382,-645,372,-634,360,-634,359,-634,359,-634,358,-634L358,-622,465,-622,464,-694,357,-695z"
},
{
"name": "Status3-Period-1",
"path": "M357,-684,358,-633C372,-635,383,-646,383,-658,383,-672,372,-682,357,-684z"
},
{
"name": "Status4-CurrentPeriod",
"path": "M535,-695,535,-682C536,-682,537,-683,538,-683,550,-683,560,-672,560,-658,560,-645,550,-634,538,-634,537,-634,536,-634,536,-634L536,-622,643,-622,642,-694,535,-695z"
},
{
"name": "Status4-Period-1",
"path": "M535,-684,536,-633C550,-635,561,-646,561,-658,561,-672,549,-682,535,-684z"
},
{
"name": "Status5-CurrentPeriod",
"path": "M713,-695,713,-682C714,-682,715,-683,716,-683,728,-683,738,-672,738,-658,738,-645,728,-634,716,-634,715,-634,715,-634,714,-634L714,-622,821,-622,820,-694,713,-695z"
},
{
"name": "Status5-Period-1",
"path": "M713,-684,714,-633C728,-635,739,-646,739,-658,739,-672,728,-682,713,-684z"
},
{
"name": "Status6-CurrentPeriod",
"path": "M892,-695,892,-682C893,-682,894,-683,895,-683,907,-683,917,-672,917,-658,917,-645,907,-634,895,-634,894,-634,893,-634,893,-634L893,-622,1000,-622,999,-694,892,-695z"
},
{
"name": "Status6-Period-1",
"path": "M892,-684,893,-633C907,-635,918,-646,918,-658,918,-672,907,-682,892,-684z"
}
]
}
]
});
});
There's a couple of ways:
1.) The easiest is to add it into your data using the value property. This is discouraged because it hardcodes the value for the map paths:
"data": [
{
"name": "Status1-CurrentPeriod",
"path": "M0,-695,0,-682C1,-682,2,-683,3,-683,15,-683,25,-672,25,-658,25,-645,15,-634,3,-634,2,-634,1,-634,1,-634L1,-622,108,-622,107,-694,0,-695z",
"value": 6 // <-- here's a numerical value for this path
}
2.) Seperate your mapData from your data. Map the values in mapData to the values in data with a joinBy. This makes your map paths reusable:
series: [{
"type": "map",
"joinBy": ['name', 'name'], // <- mapping 'name' in data to 'name' in mapData
"data": [
{
"name": "Status1-CurrentPeriod",
"value": 6
}
],
"mapData": [
{
"name": "Status1-CurrentPeriod",
"path": "M0,-695,0,-682C1,-682,2,-683,3,-683,15,-683,25,-672,25,-658,25,-645,15,-634,3,-634,2,-634,1,-634,1,-634L1,-622,108,-622,107,-694,0,-695z"
}
...
}]
Update fiddle here.
Related
Time Series Insights not showing sub-object properties of a key/value pair
I have an application that is pushing data into IoT Hub which is being used as a data source for TSI. Below is an example message: { "EnqueuedTimeUtc": "2021-06-17T22:00:47.2170000Z", "Properties": {}, "SystemProperties": { "connectionDeviceId": "Device1", "connectionAuthMethod": "{\"scope\":\"device\",\"type\":\"sas\",\"issuer\":\"iothub\",\"acceptingIpFilterRule\":null}", "connectionDeviceGenerationId": "637425408342887985", "contentType": "application/json", "contentEncoding": "utf-8", "enqueuedTime": "2021-06-17T22:00:47.2170000Z" }, "Body": { "topic": { "namespace": "spBv1.0", "edgeNodeDescriptor": "Routed Group/E2", "groupId": "Routed Group", "edgeNodeId": "E2", "deviceId": "D2", "type": "DBIRTH" }, "payload": { "timestamp": "2021-06-17T22:00:47.082Z", "metrics": [{ "name": "Ramp1", "timestamp": "2021-06-17T22:00:47.082Z", "dataType": "Int32", "metaData": {}, "properties": { "Quality": { "type": "Int32", "value": 192 }, "My Property": { "type": "String", "value": "{\"\":\"\"}" } }, "value": 77 }], "seq": 1 } } } I found documentation showing that my array of 'metrics' is supported as shown here: https://learn.microsoft.com/en-us/azure/time-series-insights/concepts-json-flattening-escaping-rules With this message, I can see 'Ramp1' show up in TSI with a value and timestamp as expected. However, the 'properties' under each metric do not show up. In this example that is 'Quality' and 'My Property'. Is there a way to get this data into TSI with an association to 'Ramp1'?
AWS CDK - trying to add Input Transformer using class aws_cdk.aws_events.RuleTargetInputProperties
As the title mentions, I'm trying to replicate a Input Transformer using RuleTargetInputProperties but i can't seem to find any examples or get the correct format to input. The template i'm trying to replicate is the following: InputTemplate: | { "sourceVersion": <sourceVersion>, "artifactsOverride": {"type": "NO_ARTIFACTS"}, "environmentVariablesOverride": [ { "name": "PULL_REQUEST_ID", "value": <pullRequestId>, "type": "PLAINTEXT" }, { "name": "REPOSITORY_NAME", "value": <repositoryName>, "type": "PLAINTEXT" }, { "name": "SOURCE_COMMIT", "value": <sourceCommit>, "type": "PLAINTEXT" }, { "name": "DESTINATION_COMMIT", "value": <destinationCommit>, "type": "PLAINTEXT" }, { "name" : "REVISION_ID", "value": <revisionId>, "type": "PLAINTEXT" } ] } InputPathsMap: sourceVersion: "$.detail.sourceCommit" pullRequestId: "$.detail.pullRequestId" repositoryName: "$.detail.repositoryNames[0]" sourceCommit: "$.detail.sourceCommit" destinationCommit: "$.detail.destinationCommit" revisionId: "$.detail.revisionId" I've tried with RuleTargetInput, but this doesn't give me the correct template on_pr_rule = repo.on_pull_request_state_change("PR", target=targets.CodeBuildProject(project, dead_letter_queue=dead_letter_queue, event=events.RuleTargetInput.from_object({ "sourceVersion": events.EventField.from_path("$.detail.sourceCommit"), "pullRequestId": events.EventField.from_path("$.detail.pullRequestId"), "repositoryName": events.EventField.from_path("$.detail.repositoryNames[0]"), "sourceCommit": events.EventField.from_path("$.detail.sourceCommit"), "destinationCommit": events.EventField.from_path("$.detail.destinationCommit"), "revisionId": events.EventField.from_path("$.detail.revisionId") }) ) ) InputTransformer: InputPathsMap: detail-sourceCommit: $.detail.sourceCommit detail-pullRequestId: $.detail.pullRequestId detail-repositoryNames-0-: $.detail.repositoryNames[0] detail-destinationCommit: $.detail.destinationCommit detail-revisionId: $.detail.revisionId InputTemplate: '{"sourceVersion":<detail-sourceCommit>,"pullRequestId":<detail-pullRequestId>,"repositoryName":<detail-repositoryNames-0->,"sourceCommit":<detail-sourceCommit>,"destinationCommit":<detail-destinationCommit>,"revisionId":<detail-revisionId>}' Has anyone had any experience with adding a template as such using RuleTargetInputProperties?
From the input, I am guessing you are working on the PR workflow. This is what I ended up with . _pr_build_events_input = events.RuleTargetInput.from_object({ "sourceVersion": events.EventField.from_path("$.detail.sourceCommit"), "artifactsOverride": {"type": "NO_ARTIFACTS"}, "environmentVariablesOverride": [ { "name": 'pullRequestId', "value": EventField.from_path('$.detail.pullRequestId'), "type": 'PLAINTEXT', }, { "name": 'repositoryName', "value": EventField.from_path('$.detail.repositoryNames[0]'), "type": 'PLAINTEXT', }, { "name": 'sourceCommit', "value": EventField.from_path('$.detail.sourceCommit'), "type": 'PLAINTEXT', }, { "name": 'destinationCommit', "value": EventField.from_path('$.detail.destinationCommit'), "type": 'PLAINTEXT', }, { "name": 'revisionId', "value": EventField.from_path('$.detail.revisionId'), "type": 'PLAINTEXT', }, ], })
How do I pass output of one node as an input parameter to another node in Argo workflow DAG
I am trying to construct a ML pipeline DAG using Argo. And I am running into an issue where I need a value from one node in the DAG to be sent as a parameter to its subsequent node. Say the ARGO DAG structure looks like the following: { "apiVersion": "argoproj.io/v1alpha1", "kind": "Workflow", "metadata": { "generateName": "workflow01-" }, "spec": { "entrypoint": "workflow01", "arguments": { "parameters": [ { "name": "log-level", "value": "INFO" } ] }, "templates": [ { "name": "workflow01", "dag": { "tasks": [ { "name": "A", "template": "task-container", "arguments": { "parameters": [ { "name": "model-type", "value": "INTENT-TRAIN" } ] } }, { "name": "B", "template": "task-container", "dependencies": ["A"], "arguments": { "parameters": [ { "name": "model-type", "value": "INTENT-EVALUATE" } ] } } ] } }, { "name": "task-container", "inputs": { "parameters": [ { "name": "model-type", "value": "NIL" } ] }, "container": { "env": [ { "name": "LOG_LEVEL", "value": "{{workflow.parameters.log-level}}" }, { "name": "MODEL_TYPE", "value": "{{inputs.parameters.model-type}}" } ] } } ] } } A -> B The computation happening in B depends on the value that has been computed in A. How will I be able to pass the value computed in A into B?
You can use Argo's "artifacts" for this - see the examples at https://github.com/argoproj/argo-workflows/tree/master/examples#artifacts Another way is to set up a shared volume: https://github.com/argoproj/argo-workflows/tree/master/examples#volumes
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);
Geojson gets distorted when trying to render in vega
I try to render a geojson in vega. I found this example which work fine: How to read geojson with vega however, when trying to replace the geojson with one of mine, the features get completely distorted. {"$schema": "https://vega.github.io/schema/vega/v3.0.json", "width": 500, "height": 600, "autosize": "none", "signals": [ { "name": "translate0", "update": "width / 2" }, { "name": "translate1", "update": "height / 2" } ], "projections": [ { "name": "projection", "type": "mercator", "scale": 1000, "rotate": [ 0, 0, 0 ], "center": [ 17, -3 ], "translate": [ { "signal": "translate0" }, { "signal": "translate1" } ] } ], "data": [ { "name": "drc", "url": "https://gist.githubusercontent.com/thomas-maschler/ef9891ef03ed4cf3fb23a4378dab485e/raw/47f3632d2135b9a783eeb76d0091762b70677c0d/drc.geojson", "format": { "type": "json", "property": "features" } } ], "marks": [ { "type": "shape", "from": { "data": "drc" }, "encode": { "update": { "strokeWidth": { "value": 0.5 }, "stroke": { "value": "darkblue" }, "fill": { "value": "lightblue" }, "fillOpacity": { "value": 0.5 } }, "hover": { "fill": { "value": "#66C2A5" }, "strokeWidth": { "value": 2 }, "stroke": { "value": "#FC8D62" } } }, "transform": [ { "type": "geoshape", "projection": "projection" } ] } ] } Here is what they are suppose to look like https://gist.github.com/thomas-maschler/ef9891ef03ed4cf3fb23a4378dab485e What am I getting wrong? Thanks, Thomas
Not sure what happened. It seems your geojson was corrupt, but not really as I eventually could parse it in www.mapshaper.org. I reduced the file to 35% and then it parsed normally: Vega-lite spec below (compile to Vega code in the editor if needed): { "$schema": "https://vega.github.io/schema/vega-lite/v2.json", "width": 700, "height": 500, "config": {"view": {"stroke": "transparent"}}, "layer": [ { "data": { "url": "https://gist.githubusercontent.com/mattijn/2ce897c2020a6e5b7ae6baf03dffe179/raw/564b6d484657864dcb77d0bb18db00fc7dc7668d/drc.geojson", "format": {"type": "json", "property": "features"} }, "mark": {"type": "geoshape", "stroke": "white", "strokeWidth": 1}, "encoding": {"color": {"value": "#bcbcbc"}} } ] }