London Escorts sunderland escorts 1v1.lol unblocked yohoho 76 https://www.symbaloo.com/mix/yohoho?lang=EN yohoho https://www.symbaloo.com/mix/agariounblockedpvp https://yohoho-io.app/ https://www.symbaloo.com/mix/agariounblockedschool1?lang=EN
2.1 C
New York
Saturday, February 1, 2025

ios – Swift chart challenge: begin and finish y worth related for a number of line plots


I’m making an attempt to implement a inventory chart with swift with two plots: one is the worth and the opposite is a prediction/approximate for the worth. I attempted to implement this through the use of two loops of LineMark like beneath. For testing function, I used the identical dataset with one’s x worth shifted up by 1. However I bought the next challenge the place the beginning and finish y values are related once I add in a second loop of LineMark. How can I repair this?

VStack {
                 
            Chart {
                ForEach(self.entries, id: .date) { entry in
                    LineMark(
                        x: .worth("Date", entry.date),
                        y: .worth("Worth", entry.closePrice + 1)
                    ).foregroundStyle(.inexperienced)
                    
                }
                ForEach(self.entries, id: .date) { entry in
                    LineMark(
                        x: .worth("Date", entry.date),
                        y: .worth("Worth", entry.closePrice)
                    )
                    .foregroundStyle(.blue)
                    
                    
                    let curGradient = LinearGradient(
                        gradient: Gradient (
                            colours: [
                                .green.opacity(0.5),
                                .green.opacity(0.2),
                                .green.opacity(0.05),
                            ]
                        ),
                        startPoint: .prime,
                        endPoint: .backside
                    )
                    
                    AreaMark(
                        x: .worth("Date", entry.date),
                        yStart: .worth("Worth", spherical(minY - ((maxY - minY) / 100) * 20)),
                        yEnd: .worth("PriceEnd", entry.closePrice)
                    )
                    
                    .interpolationMethod(.cardinal)
                    .foregroundStyle(curGradient)
                    .alignsMarkStylesWithPlotArea()
                    
                }
                
            }
            .chartLegend(place: .prime, alignment: .heart)
            .chartYScale(area: minY - ((maxY - minY) / 100) * 20...maxY + ((maxY - minY) / 100) * 20)
            .chartXAxis
            {
                AxisMarks(values: .stride(by: .day))
                { date in
                    AxisGridLine()
                    AxisValueLabel(format: .dateTime.weekday(.slender), centered: true)
                }
            }.chartYAxis {
                AxisMarks(place: .main)
            }
            
        }.body(width: 347, peak: 161.5)

Related Articles

Social Media Auto Publish Powered By : XYZScripts.com