I have difficulty to use strokeBorder after trim in SwiftUI, how can do this?
Circle()
.trim(from: 0, to: 0.5)
.strokeBorder(Color.red, style: StrokeStyle(lineWidth: 50.0, lineCap: .round, lineJoin: .round))
Error:
Value of type 'some Shape' has no member 'strokeBorder'
There is at least 2 ways to get the result like strokeBorder gives. But they are not using strokeBorder, I want solve the issue while using strokeBorder.
Related
Trying to set a Mapbox style from a local JSON file in plotly dash app.
mapbox_token = <mytoken>
local_style=
json.load(open(application_root_path+r'/pages/campaignmap/mapbox_style.json'))
fig = go.Figure(
go.Scattermapbox(
mode="lines", fill="toself",
lon=[-10, -10, 8, 8, -10, None, 30, 30, 50,
50, 30, None, 100, 100, 80, 80, 100],
lat=[30, 6, 6, 30, 30, None, 20, 30, 30, 20, 20, None, 40, 50, 50, 40, 40],))
fig.update_layout(
dict1={"mapbox": {"accesstoken": mapbox_token}})
fig.update_layout(
showlegend=False,
margin={'l': 0, 'r': 0, 'b': 0, 't': 0},
mapbox_style=local_style
)
Based on the documentation on the plotly website Mapbox Map Layers in Python (see image below) this should work. The JSON file contains the export of the style from MapBox and it works fine when I use the service URL (second last dot point in image).
I've tried loading the JSON as string, dictionary and file path in the mapbox_style parameter with no luck.
Any ideas on how to make it load?
I've tried the same things you've described and had no luck. I can provide a style URL and it works perfectly, but if I download that style and provide just the style.json representation of that same style, I can't seem to get Plotly to recognize it...
I am using react native svg charts to display some data on line chart .the data is associated with some time which need to be labelled on x axis can anybody tell me how can I do it.
When we look at LineChart, it draws the lines like this.
It accepts 50 as points and 10 points and draws a line between
It accepts 10 as points and 40 points and draws a line between
class LineChartExample extends React.PureComponent {
render() {
const data = [50, 10, 40, 95, -4, -24, 85, 91, 35, 53, -53, 24, 50, -20, -80]
return (
<LineChart
style={{ height: 200 }}
data={data}
svg={{ stroke: 'rgb(134, 65, 244)' }}
contentInset={{ top: 20, bottom: 20 }}
>
<Grid />
</LineChart>
)
}
}
So I have these two texts that I'm trying to align at the same pixel basically, but it seems that one is more offset than the other. Like so, the one on the bottom seems to be further left than the other.
Here is the code:
VStack(alignment: .leading) {
Text("Enter your phone number")
.padding(15)
.frame(alignment: .leading)
.foregroundColor(Color.white)
.font(Font.custom("URWDIN-Thin", size: 30))
//Subtitle
Text("You will be sent a code for verification")
.padding(15)
.frame(alignment: .leading)
.foregroundColor(Color.white)
.font(Font.custom("URWDIN-Thin", size: 16))
Any idea as to why this may be?
You have chosen a font in which capital ‘E’ has a noticeable left side bearing. Left side bearing is the distance from the “pen position” to the left edge of the tight bounding box of the glyph.
That's why your lines of text look misaligned. Here's my test:
PlaygroundPage.current.setLiveView(
VStack(alignment: .leading) {
Text("Enter your phone number")
.border(Color.red, width: 1)
.font(Font.custom("URWDIN-Thin", size: 30))
Text("You will be sent a code for verification")
.border(Color.red, width: 1)
.font(Font.custom("URWDIN-Thin", size: 16))
Text("Enter your phone number")
.border(Color.red, width: 1)
.font(Font.system(size: 30))
Text("You will be sent a code for verification")
.border(Color.red, width: 1)
.font(Font.system(size: 16))
}
)
Output:
Notice how, in both URW DIN Thin and in the system font (SF Pro), the capital ‘Y’ has a left side bearing of essentially zero: both glyphs touch the left edge of the frame.
The left side bearing of SF Pro's capital ‘E’ is not zero but it's small: a fraction of the vertical stroke width.
But the left side bearing of the capital ‘E’ in DRW UDM Thin is significant. It's about twice the vertical stroke width. That makes it quite noticeable compared to the zero bearing of the capital ‘Y’.
Can i create line graph which is the data get from previous page. I have done a calculation on my previous page. I would like to create line graph using the result and times. I face the problem to adjust the coding below because the coding below show the data was fix.
series: <LineSeries<SalesData, String>>[
LineSeries<SalesData, String>(
dataSource: <SalesData>[
SalesData('Jan', 35),
SalesData('Feb', 28),
SalesData('Mar', 34),
SalesData('Apr', 32),
SalesData('May', 40)
],
I'm following a SpriteKit tutorial video from Rob Percival, and this line of code does not compile. It seems the syntax is out of date for getting the "mid x" and "mid y" values. What are the replacements for CGRectGetMidX() and CGRectGetMidY()?
CGPoint(x: CGRectGetMidX(self.frame),y: CGRectGetMidY(self.frame))
The syntax for just about everything changed with Swift 3.
You want:
man.position = CGPoint(x: self.frame.midX, y: self.frame.midY)
See the documentation for CGRect for more details.