To add an image to a StandardCard card, I set
Image image = new Image();
where Image comes from com.amazon.speech.ui. Various blogs then say to use
image.setSmallSourceUrl and image.setLargeSourceUrl to set the URLs of the image but these two methods seem to have been deprecated in alexa-skills-kit-1.4.0.
Furthermore, there seem to be two (incompatible) Image classes in play. One in com.amazon.speech.ui.Image and another in com.amazon.speech.speechlet.interfaces.display.element.Image.
1) What is the correct way of adding the two images to a StandardCard?
2) Which of the two image types does StandardCard want?
Below shows the format of response,
{
"version": "1.0",
"response": {
"outputSpeech": {"type":"PlainText","text":"output speech"},
"card": {
"type": "Standard",
"title": "Title",
"text": "sample test",
"image": {
"smallImageUrl": "YourSmallImage here",
"largeImageUrl": "YourLarge image here"
}
}
}
You can provide images in the following formats:
JPEG
PNG
smallImageUrl recommended size is 720w x 480h (in pixels) and largeImageUrl recommended size is 1200w x 800h (in pixels)
Related
I'm using QT 5.12.4 with the MapboxGl plugin and I'm trying to figure out how to make the street names display in a larger font but I'm very confused about how to specify a text size. I need to change the size dynamically so using a predefined style is not going to meet the requirements.
The two confusing aspects are that Mapbox's documentation has to be translated into "MapParameters" for QML and I'm clueless as to what exactly is needed to change the text size. Between reading through the documentation and playing with the mapbox studio it seems like I need to modify the "road-label" layer. If anyone has some sample code of how to change the text size I would really appreciate it if you could share.
https://docs.mapbox.com/mapbox-gl-js/style-spec/#layout-symbol-text-size
MapParameter
{
type: "layout"
property var layer: "road-label"
property var textSize: 20
}
What you did looks correct. You need to define a MapParameter with the type layout because the text-size is a layout property in the Mapbox Style Specification. We cannot use - on QML variable names, so we camelCase it to textSize. After that you can bind textSize to anything you want.
You need to make sure that the layer road-label exists on the style at the moment the MapParameter is added.
I solved the problem and the key was getting the JSON for the predefined style that I was using (navigation-preview-day-v2). This post showed me how to get the pre-defined sytle:
URL for Mapbox style sheet JSON
For the navigation-preview-day-v2 style, the URL would be:
https://api.mapbox.com/styles/v1/mapbox/navigation-preview-day-v2?access_token=(your token here)
Run the JSON through a formatter so you can read it and find the layer(s) where the street names are rendered. In this case, there are four layers:
road-label-small
road-label-medium
road-label-large
road-label-extra-large
Here is an example of how to form the MapParameter in QML for the font size:
MapParameter
{
type: "layout"
property var layer: "road-label-large"
property var textSize:
{
"base": 1,
"stops":
[
[9, 10],
[20, 16]
]
}
}
You can also import the JSON into Mapbox Studio to review or manipulate the style. In my case I wanted to dynamically scale the font size so in my QML I added a scale factor and the resulting MapParameter is:
MapParameter
{
type: "layout"
property var layer: "road-label-large"
property var textSize:
{
"base": 1,
"stops":
[
[9, Math.floor(10 * fontScaleFactor)],
[20, Math.floor(16 * fontScaleFactor)]
]
}
}
We are integrating WordPress with Apple News. We are able to show the photo caption, but we are unable to show photo credits. By Apple News documentation only caption is available. But there are few publisher in AN showing credits too.
Any hint will be help full.
https://developer.apple.com/documentation/apple_news/photo#properties
The "caption" property in the Apple News Photo component is actually just there for accessibility purposes / for when the photo is full screen, it doesn't show up beneath the image. What you'll need to do instead is a Caption component beneath the Photo component. You can see an example of this here in the Apple News documentation.
Apple News allows you to do this with HTML and Markdown but you can also avail of inlineTextStyles. Just note where the what position (character count) you want the style to begin and end.
In this case, that first open-bracket begins at character number 23, and closes at character 43.
{
"role": "caption",
"text": "The text of the caption (Jane X for Reuters)",
"textStyle": "default-body",
"inlineTextStyles": [
{
"rangeStart": 23,
"rangeLength": 43,
"textStyle": {
"textColor": "#FF0000",
"backgroundColor": "#000"
}
}
]
}
Source:
https://developer.apple.com/documentation/apple_news/inlinetextstyle
When initialing loading the vis network chart, all nodes crowded together, due to some reason I could not set layout improvedLayout to true, and also I need to set physics to disable.
here is my option setting, please advise how I can let the nodes positioned well within the following option setting.
var options = {
"edges": {
"smooth": { "forceDirection": "none" }
},
"physics": { "enabled": false, "minVelocity": 0.75 },
"layout": { improvedLayout: _improvedLayout }
}
initialing loading, all nodes stay together which makes me hard to see them:
with improvedLayout set to true, it displays well, but the performance is really bad I could not set it in this way.
here is an example: I have 77 edges and 65 nodes, it took 7-8 seconds to draw the network picture when I set improvedLayout to true, is that normal?
I need That the header shows when I export the Chart to Image
My Chart is Like This :
But when I export it to Image it's Without the header
Can any one help me to fix this , Txs, Marwen
AmChart widget allows you to export only widget's content without box header.
You can achieve needed result with AmChart's functionality.
Just set below code as a value to
"Edit... > Widget > Advanced Properties > Extra Options"
:{"allLabels": [
{
"text": "Product Sale",
"size": 32,
"bold": true,
"x": 0,
"y": 0
}]}
UPDATE
If your title overlays the chart you can try to change widget box's height and width along with extending "Extra options" with "marginLeft" and "marginTop" options which allow you to create needed room for chart and it's title:
:{"allLabels": [
{
"text": "Product Sale",
"size": 32,
"bold": true,
"x": 0,
"y": 0
}],
"marginTop":50,
"marginLeft":50}
I have a horizontal SerialChart with AmCharts:
When displayed at a desktop browser, everything looks fine:
But when i'm resizing, the bars are getting smaller, but the text
stays the same:
Is there a way of resizing the categoryAxis as well so i see the bars
in a mobile screen? Or move the Labels on top of the bars when i'm
viewing them on mobile?
Try this, it will help to you.
"categoryAxis": {
"ignoreAxisWidth": true,
"autoWrap": true
}
If you look at this example I have just done, http://jsfiddle.net/17xraeue/, you will see that I have added a line break in standard HTML tags, BR, into the name.
"dataProvider": [
{
"country": "All Other<br>Countries",
"visits": 441,
"color": "#CD0D74"
}
]
To make this work dymanically without having to add line breaks in yourself you could also use a scripting langauge such as PHP to add them for you.
<?
//See http://php.net/manual/en/function.wordwrap.php for more details
//wordwrap([text string], [number of characters before line break], [HTML to use for line break]);
echo wordwrap("this is my text string", 20, "<br />");
?>