Part colour doesn't pull through from Configured Products - roomle

I have an issue that I have created 4 derived Products from a single part, that each part has a different Colour / Material set within it. I have the 4 Products called as PossibleChildren in my main part but when I try and bring in one of the 4 Products which ever is the first colour I pick, is the only colour that will select, so if for example I select RED for my first part, if I then pick the BLUE part it still only places the RED part. I created the 4 Products by importing this text...
"item_id","configuration"
"sub_s2_8t15","{""componentId"":""racksystems_test:sub_fronttile"",""parameters"":
{""tileColour"":""racksystems_test:s2_8t15""}}"
"sub_s2_7t58","{""componentId"":""racksystems_test:sub_fronttile"",""parameters"":
{""tileColour"":""racksystems_test:s2_7t58""}}"
"sub_s2_4t50","{""componentId"":""racksystems_test:sub_fronttile"",""parameters"":
{""tileColour"":""racksystems_test:s2_4t50""}}"
"sub_twinwall","{""componentId"":""racksystems_test:sub_fronttile"",""parameters"":
{""tileColour"":""racksystems_test:twinwall""}}"
And then in the master.json part I call the 4 created Products...
"itemId": "racksystems_test:sub_s2_8t15",
"condition":"((version=='Rack')&&(company=='BetaTest'))"
}, {
"itemId": "racksystems_test:sub_s2_7t58",
"condition":"((version=='Rack')&&(company=='BetaTest'))"
}, {
"itemId": "racksystems_test:sub_s2_4t50",
"condition":"((version=='Rack')&&(company=='BetaTest'))"
}, {
"itemId": "racksystems_test:sub_twinwall",
"condition":"((version=='Rack')&&(company=='BetaTest'))"
},
I have a KEY in the sub_fronttile.json as this..
{
"key": "tileColour",
"type": "Material",
"labels": {
"en": "Tile Colour?"
},
"defaultValue": "",
"valueObjects": [
{
"value": "racksystems_test:red",
"labels": {
"en": "Black"
}
},
........
Then call the colour in my geometry like this...
AddCube(Vector3f{infillWidth-20,materialThickness,infillHeight-20});
SetObjSurface(tileColour);
MoveMatrixBy(Vector3f{20,-offset,40});
So master.json is my main part and sub_fronttile.json contains my products

Is tileColour a global parameter? If yes, then the global value is assigned on dock. If tileCoulour is not a global parameter, this should not happen unless an assignmentOnDock is used.
In order to workaround the assignment in global parameters, it might help to:
have two parameters instead, tileColour_local, tileColour_global where one is global and not visible, other is not global and is visible.
tileColour_global.onValueChange: "if (parameter.userTriggeredChange) { tileColour_local = tileColour_global; }

Related

With the Google Slides API is there a ways to know the height of the text in a shape?

I want to have a shape with text where the text fits neatly inside the shape. To do this I need to know how tall the text in a textElement will be inside a given shape, is there a way to do this?
Answer:
You can get the information of the font size of text inside a Shape using presentations.get with a field mask.
More Information:
The structure of a Shape with text is as follows (irrelevant fields omitted):
{
"shapeType": enum (Type),
"text": {
"textElements": [
{
"textRun": {
"style": {
"fontSize": {
"magnitude": 18,
"unit": "PT"
},
}
},
}
],
},
...
}
You can get this with the field mask:
slides/pageElements/shape/text/textElements/textRun/style/fontSize
Example Request:
slides.presentations.get({
"presentationId": "1x1iiFW0TbP3yPXRldYogXLEGT-tYfa79a2X8ZDIq8tU",
"fields": "slides/pageElements/shape/text/textElements/textRun/style/fontSize"
});
Note: The API does not return if the text wraps across multiple lines or not. This isn't retrievable due to the nature of font sizes. If the font you were using is a monospace font, it may however be possible to work this out based on the width of the Shape and the width of the characters contained within it.
References:
Text - Page.TextStyle | Slides API | Google Developers
Working with field masks | Slides API | Google Developers

Show data table from JSON in iPad app

I have a API which returns JSON:
{
"id": 1,
"name": "A green door",
"price": 12.50,
"tags": ["home", "green"]
}
{
"id": 2,
"name": "A blue door",
"price": 13.50,
"tags": ["work", "blue"]
}
In iPad app, I need to show this in the following data table format:
id name price tags
1 A green door 12.50 home, green
2 A blue door 13.50 work, blue
I have tried the following https://github.com/brightec/CustomCollectionViewLayout but it does not work.
How can it be done?
You can create a simple table view. I created a simple example with your data. Sorry, I don't have time to add comments and the UI is basic.
Check the following example:
Show data into table view

white spaces - slack (webhook)

It looks like there is no option post a message containing a table on to slack. I am trying to build a table using text formatting. In the below example the text isn't aligned because first row has text ROW1 and second row has text ROW. Is there a way to add a white space after ROW in order to align this text?
{"text" : "ROW1\t\t\t\tCOL1\nROW\t\t\t\tCOL2"}
Generally speaking, you can use Slack's message builder to test the rendering of your messages.
This being said, while I dont think you can simply "push" spaces to the right, you could use the pipe symbol like this :
"text": "ROW1|\t\t\t\tCOL1\nROW |\t\t\t\tCOL2"
Another possibility, with minor changes, is to use attachements with fields like this
"attachments": [
{
"fields": [
{
"title": "Col1",
"value": "text1",
"short": true
},
{
"title": "Col2",
"value": "text2",
"short": true
}
]
}
]

how to make a scatter with regression line graph in amcharts / highcharts?

I read all amcharts and highcharts demo and cant figure out how to draw chart like
The issue I am having is the X axis is text, not numeric like most amcharts/highcharts demos are.
It doesn't matter that you have categories on the x axis, as far as the scatter plot is concerned - your x values are the array index of the categories (0-5 in the case of your image).
There is a plugin to auto calculate a regression line, here:
http://www.highcharts.com/plugin-registry/single/22/Highcharts%20regression
Or, you can calculate your own and plot it normally.
However, a regression line through a group of categories doesn't make much sense. I don't see how it can tell you anything useful, and is probably more likely to cause confusion or outright misunderstanding.
This seems to me to be data that would be more appropriate to plot with a bar chart than a scatter plot.
FWIW
{{edit:
After looking at this longer, I am somewhat unclear: is that actually a regression line, or is that an average, or a target...?
If that's the case, you can either plot it is a line series, or you can use plotLines:
http://api.highcharts.com/highcharts#yAxis.plotLines
Example with a plotLine:
http://jsfiddle.net/jlbriggs/3d3fuhbb/63/
The chart like this is very easily done using amCharts regular Serial chart with line graph with bullets (bullet: "diamond") and no line (lineAlpha: 0).
var chart = AmCharts.makeChart( "chartdiv", {
"type": "serial",
"dataProvider": [ {
"category": "Civil",
"value": 0.87
}, {
"category": "Piping",
"value": 1.1
}, {
"category": "Mechanical",
"value": 0.69
}, {
"category": "Electrical",
"value": 0.82
}, {
"category": "Insulation",
"value": 1.42
}, {
"category": "Completion",
"value": 1.1
} ],
"valueAxes": [ {
"guides": [{
"value": 1,
"lineAlpha": 1,
"lineThickness": 2,
"lineColor": "#f00"
}]
} ],
"startDuration": 1,
"graphs": [ {
"lineAlpha": 0,
"bullet": "diamond",
"valueField": "value",
"lineColor": "#5782bf"
} ],
"chartCursor": {
"categoryBalloonEnabled": false,
"cursorAlpha": 0,
"zoomable": false
},
"categoryField": "category",
"categoryAxis": {
"gridPosition": "start",
"gridAlpha": 0,
"tickPosition": "start"
}
} );
<script src="http://www.amcharts.com/lib/3/amcharts.js"></script>
<script src="http://www.amcharts.com/lib/3/serial.js"></script>
<div id="chartdiv" style="width: 600px; height: 200px;"></div>

labelColor not responding in Passbook coupon type pass

All my Passbook environment works fine (PHP/MySQL based server for pass generation and signing, and the pass download - webview based download, emailing the pass or presenting inside my app with PassKit).
The only thing that is not working is the color of the labelColor in the primary fields of a coupon type pass.
I have (in the pass.json file):
"foregroundColor" : "rgb(30, 30, 30)",
"backgroundColor" : "rgb(230, 230, 230)",
"labelColor" : "rgb(30, 30, 30)",
The foregroundColor and backgroundColor work fine, but the labelColor (presented on top of the strip image) is white, instead of the labelColor specified.
According to AppleĀ“s Passbook package reference, the labelColor is optional
"Optional. Color of the label text, specified as a CSS-style RGB triple. For example, rgb(255, 255, 255). If omitted, the label color is determined automatically."
In this case, the strip image is a clear image so, the text should be black (even if labelColor omitted and the color determined automatically), but the try appears white in the pass
Any help would be appreciated.
... e
Label and foreground colors are only applied to primary field labels and values when there is no strip image in the pass. Where a strip image exists, the text color is automatically changed to white.
There is an undocumented parameter stripColor that can be used to set the colour of the text over a strip image. This changes both the field and the label.
This parameter has been around since the early iOS6 betas. However, use with caution. Just because it works today is no guarantee it will work in the future.
I found that using the "stripColor" does change the text in the strip outside of the "foregroundColor" parameter. This is still the case in iOS 8+
Here is example of where to put the "stripColor" in the json.
passJson = {
"formatVersion": 1,
"passTypeIdentifier": "pass type goes here",
"serialNumber": "serialNumber goes here",
"teamIdentifier": "",
"organizationName": "",
"description": "",
"logoText": "My Logo",
"foregroundColor": "rgb(150,0,150)",
"backgroundColor": "rgb(255, 255, 255)",
"labelColor": "rgb(0, 0, 0)",
"stripColor": "rgb(255,255,255)",
"associatedStoreIdentifiers": [
],
"associatedApps": [
{
"title": "Name of your app"
}
],
"barcode": {
"message": "coupon",
"format": "PKBarcodeFormatPDF417",
"messageEncoding": "iso-8859-1",
"altText": "coupon"
},
"coupon": {
"primaryFields": [
{
"key": "offer",
"label": "Offer text 2",
"value": "Offer text 1"
}
],
"secondaryFields": [
{
"label": "Expires",
"value": "09/26/2015",
"key": "expires"
}
],
"backFields": [
{
"label": "TERMS AND CONDITIONS",
"value": "Back of pass",
"key": "terms"
}
]
}
}

Resources