View in English

  • Apple Developer
    • Get Started

    Explore Get Started

    • Overview
    • Learn
    • Apple Developer Program

    Stay Updated

    • Latest News
    • Hello Developer
    • Platforms

    Explore Platforms

    • Apple Platforms
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store

    Featured

    • Design
    • Distribution
    • Games
    • Accessories
    • Web
    • Home
    • CarPlay
    • Technologies

    Explore Technologies

    • Overview
    • Xcode
    • Swift
    • SwiftUI

    Featured

    • Accessibility
    • App Intents
    • Apple Intelligence
    • Games
    • Machine Learning & AI
    • Security
    • Xcode Cloud
    • Community

    Explore Community

    • Overview
    • Meet with Apple events
    • Community-driven events
    • Developer Forums
    • Open Source

    Featured

    • WWDC
    • Swift Student Challenge
    • Developer Stories
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Centers
    • Documentation

    Explore Documentation

    • Documentation Library
    • Technology Overviews
    • Sample Code
    • Human Interface Guidelines
    • Videos

    Release Notes

    • Featured Updates
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • tvOS
    • Xcode
    • Downloads

    Explore Downloads

    • All Downloads
    • Operating Systems
    • Applications
    • Design Resources

    Featured

    • Xcode
    • TestFlight
    • Fonts
    • SF Symbols
    • Icon Composer
    • Support

    Explore Support

    • Overview
    • Help Guides
    • Developer Forums
    • Feedback Assistant
    • Contact Us

    Featured

    • Account Help
    • App Review Guidelines
    • App Store Connect Help
    • Upcoming Requirements
    • Agreements and Guidelines
    • System Status
  • Quick Links

    • Events
    • News
    • Forums
    • Sample Code
    • Videos
 

Vidéos

Ouvrir le menu Fermer le menu
  • Collections
  • Toutes les vidéos
  • À propos

Plus de vidéos

  • À propos
  • Code
  • Swift Charts: Vectorized and function plots

    The plot thickens! Learn how to render beautiful charts representing math functions and extensive datasets using function and vectorized plots in your app. Whether you're looking to display functions common in aerodynamics, magnetism, and higher order field theory, or create large interactive heat maps, Swift Charts has you covered.

    Chapitres

    • 0:00 - Introduction
    • 1:01 - Function plots
    • 6:48 - Vectorized plots
    • 11:27 - Best practices

    Ressources

    • Creating a data visualization dashboard with Swift Charts
    • Swift Charts updates
    • Forum: UI Frameworks
      • Vidéo HD
      • Vidéo SD

    Vidéos connexes

    WWDC23

    • Explore pie charts and interactivity in Swift Charts

    WWDC22

    • Hello Swift Charts
    • Swift Charts: Raise the bar
  • Rechercher dans cette vidéo…
    • 1:43 - Histogram that shows distribution of capacity density

      Chart {
        ForEach(bins) { bin in
          BarMark(
            x: .value("Capacity density", bin.range),
            y: .value("Probability", bin.probability)
          )
        }
      }
    • 2:18 - Visualize function with LinePlot​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

      Chart {
        LinePlot(
          x: "Capacity density", y: "Probability"
        ) { x in // (Double) -> Double
          normalDistribution(
            x,
            mean: mean, 
            standardDeviation: standardDeviation
          )
        }
      }
    • 3:36 - Customize function plot with modifiers

      Chart {
        LinePlot(
          x: "Capacity density", y: "Probability"
        ) { x in
          normalDistribution(x, ...)
        }
        .foregroundStyle(.gray
      }
    • 3:57 - Visualize area under a curve with AreaPlot​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

      Chart {
        AreaPlot(
          x: "Capacity density", y: "Probability"
        ) { x in
          normalDistribution(x, ...)
        }
        .foregroundStyle(.gray)
        .opacity(0.2)
      }
    • 4:21 - Visualize area between curves with AreaPlot

      Chart {
        AreaPlot(
          x: "x", yStart: "cos(x)", yEnd: "sin(x)"
        ) { x in
          (yStart: cos(x / 180 * .pi),
           yEnd: sin(x / 180 * .pi))
        }
      }
    • 4:59 - Specify domain for function plots

      Chart {
        AreaPlot(
          x: "x", yStart: "cos(x)", yEnd: "sin(x)"
        ) { x in
          (yStart: cos(x / 180 * .pi),
           yEnd: sin(x / 180 * .pi))
        }
      }
      .chartXScale(domain: -315...225)
      .chartYScale(domain: -5...5)
    • 5:18 - Specify sampling domain for function plots

      Chart {
        AreaPlot(
          x: "x", yStart: "cos(x)", yEnd: "sin(x)",
          domain: -135...45
        ) { x in
          (yStart: cos(x / 180 * .pi),
           yEnd: sin(x / 180 * .pi))
        }
      }
      .chartXScale(domain: -315...225)
      .chartYScale(domain: -5...5)
    • 5:55 - Visualize parametric functions

      Chart {
        LinePlot(
          x: "x", y: "y", t: "t", domain: -.pi ... .pi
        ) { t in
          let x = sqrt(2) * pow(sin(t), 3)
          let y = cos(t) * (2 - cos(t) - pow(cos(t), 2))
          return (x, y)
        }
      }
      .chartXScale(domain: -3...3)
      .chartYScale(domain: -4...2)
    • 6:40 - Use Double.nan to represent no value

      Chart {
        LinePlot(x: "x", y: "1 / x") { x in
          guard x != 0 else {
            return .nan
          }
          return 1 / x
        }
      }
      .chartXScale(domain: -10...10)
      .chartYScale(domain: -10...10)
    • 7:43 - Highly customized Chart

      Chart {
        ForEach(model.data) {
          if $0.capacityDensity > 0.0001 {
            RectangleMark(
              x: .value("Longitude", $0.x),
              y: .value("Latitude", $0.y)
            )
            .foregroundStyle(by: .value("Axis type", $0.axisType))
          } else {
            PointMark(
              x: .value("Longitude", $0.x),
              y: .value("Latitude", $0.y)
            )
            .opacity(0.5)
          }
        }
      }
    • 8:00 - Homogeneously styled Chart

      Chart {
        ForEach(model.data) {
          RectangleMark(
            x: .value("Longitude", $0.x),
            y: .value("Latitude", $0.y)
          )
          .foregroundStyle(by: .value("Axis type", $0.panelAxisType))
          .opacity($0.capacityDensity)
        }
      }
    • 8:23 - Vectorized plot for homogeneously styled chart

      Chart {
        RectanglePlot(
          model.data,
          x: .value("Longitude", \.x),
          y: .value("Latitude", \.y)
        )
        .foregroundStyle(by: .value("Axis type", \.panelAxisType))
        .opacity(\.capacityDensity)
      }
    • 9:42 - Vectorized point plot API

      Chart {
        PointPlot(
          model.data,
          x: .value("Longitude", \.x),
          y: .value("Latitude", \.y)
        )
      }
    • 10:26 - Vectorized plot modifiers

      Chart {
        PointPlot(
          model.data,
          x: .value("Longitude", \.x),
          y: .value("Latitude", \.y)
        )
        .symbolSize(by: .value("Capacity", \.capacity))
        .foregroundStyle(
          by: .value("Axis type", \.panelAxisType)
        )
      }

Developer Footer

  • Vidéos
  • WWDC24
  • Swift Charts: Vectorized and function plots
  • Open Menu Close Menu
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store
    Open Menu Close Menu
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • Icon Composer
    • SF Symbols
    Open Menu Close Menu
    • Accessibility
    • Accessories
    • Apple Intelligence
    • Audio & Video
    • Augmented Reality
    • Business
    • Design
    • Distribution
    • Education
    • Games
    • Health & Fitness
    • In-App Purchase
    • Localization
    • Maps & Location
    • Machine Learning & AI
    • Security
    • Safari & Web
    Open Menu Close Menu
    • Documentation
    • Downloads
    • Sample Code
    • Videos
    Open Menu Close Menu
    • Help Guides & Articles
    • Contact Us
    • Forums
    • Feedback & Bug Reporting
    • System Status
    Open Menu Close Menu
    • Apple Developer
    • App Store Connect
    • Certificates, IDs, & Profiles
    • Feedback Assistant
    Open Menu Close Menu
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program
    • Mini Apps Partner Program
    • News Partner Program
    • Video Partner Program
    • Security Bounty Program
    • Security Research Device Program
    Open Menu Close Menu
    • Meet with Apple
    • Apple Developer Centers
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Academies
    • WWDC
    Read the latest news.
    Get the Apple Developer app.
    Copyright © 2026 Apple Inc. All rights reserved.
    Terms of Use Privacy Policy Agreements and Guidelines