Back to LibraryCharts
Line Chart
Added Jun 16, 2026
A smooth curved line chart powered by a Power Apps collection. Inspired by the shadcn/ui Line Chart.
Dark Mode
Line Chart
January - June 2024
Trending up by 5.2% this month
Showing total visitors for the last 6 months
CopySnips Live Preview
How to Use
- Create the collection: ClearCollect(colLineChartData, {month: "January", Value: 186}, {month: "February", Value: 305}, {month: "March", Value: 237}, {month: "April", Value: 73}, {month: "May", Value: 209}, {month: "June", Value: 214})
- On your screen's OnVisible, add: Set(varLineChartAnimate, true); Set(varTooltipLineIdx, 0)
- Paste the copied YAML into Power Apps Studio (Ctrl+V).
- Click any data point to show a tooltip; click again to dismiss.
- To replay the animation: Set(varLineChartAnimate, false); Set(varLineChartAnimate, true)
- Replace colLineChartData with any data source that has {month, Value} columns.
Problem Solved
Renders a smooth curved SVG line chart inside a Power Apps Image control. No external charting library needed.
Integration
Bind colLineChartData to any data source with {month, Value} columns. The chart redraws automatically when the collection changes.
YAML Code
- conLineChart:
Control: GroupContainer@1.5.0
Variant: ManualLayout
Properties:
BorderColor: =RGBA(226, 232, 240, 1)
BorderStyle: =BorderStyle.Solid
BorderThickness: =1
DropShadow: =DropShadow.Regular
Fill: =RGBA(255, 255, 255, 1)
Height: =316
RadiusBottomLeft: =12
RadiusBottomRight: =12
RadiusTopLeft: =12
RadiusTopRight: =12
Width: =440
Children:
- tmrLineChartAnimate:
Control: Timer@2.0.0
Properties:
Duration: =1200
Height: =1
OnTimerEnd: =Set(varLineChartAnimate, false)
Repeat: =false
Start: =varLineChartAnimate
Visible: =false
Width: =1
X: =0
Y: =0
- lblLineTitle:
Control: Label@2.5.1
Properties:
Color: =RGBA(15, 23, 42, 1)
Font: =Font.'Open Sans'
FontWeight: =FontWeight.Bold
Height: =24
Size: =14
Text: ="Line Chart"
Width: =400
X: =20
Y: =14
- lblLineDescription:
Control: Label@2.5.1
Properties:
Color: =RGBA(100, 116, 139, 1)
Font: =Font.'Open Sans'
Height: =20
Size: =12
Text: ="January - June 2024"
Width: =400
X: =20
Y: =44
- rectLineHeaderLine:
Control: Rectangle@2.3.0
Properties:
Fill: =RGBA(226, 232, 240, 1)
Height: =1
Width: =440
X: =0
Y: =68
- imgLineChart:
Control: Image@2.2.3
Properties:
Height: =172
Width: =416
X: =12
Y: =72
Image: |-
=With(
{
_n: CountRows(colLineChartData),
_max: Max(1, Max(colLineChartData, Value)),
_slot: Int(400 / Max(1, CountRows(colLineChartData))),
_p: Min(1, tmrLineChartAnimate.Value / 1200)
},
With(
{ _ease: 1 - Power(Max(0, 1 - _p), 3) },
"data:image/svg+xml;utf8, " & EncodeUrl(
"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 416 172'>" &
"<line x1='8' y1='8' x2='408' y2='8' stroke='#e2e8f0' stroke-width='1'/>" &
"<line x1='8' y1='44' x2='408' y2='44' stroke='#e2e8f0' stroke-width='1'/>" &
"<line x1='8' y1='80' x2='408' y2='80' stroke='#e2e8f0' stroke-width='1'/>" &
"<line x1='8' y1='116' x2='408' y2='116' stroke='#e2e8f0' stroke-width='1'/>" &
"<line x1='8' y1='152' x2='408' y2='152' stroke='#e2e8f0' stroke-width='1'/>" &
"<path d='M " &
Text(Int(8 + (1 - 0.5)*_slot)) & "," & Text(Int(152 - Index(colLineChartData, 1).Value/_max*144*_ease)) &
" L " & Text(Int(8 + _slot)) & "," & Text(Int(152 - (Index(colLineChartData, 1).Value + Index(colLineChartData, 2).Value)*72/_max*_ease)) &
Concat(Sequence(_n - 2, 1),
" Q " & Text(Int(8 + (Value + 0.5)*_slot)) & "," & Text(Int(152 - Index(colLineChartData, Value + 1).Value/_max*144*_ease)) &
" " & Text(Int(8 + (Value + 1)*_slot)) & "," & Text(Int(152 - (Index(colLineChartData, Value + 1).Value + Index(colLineChartData, Value + 2).Value)*72/_max*_ease))
) &
" L " & Text(Int(8 + (_n - 0.5)*_slot)) & "," & Text(Int(152 - Index(colLineChartData, _n).Value/_max*144*_ease)) &
"' fill='none' stroke='#3b82f6' stroke-width='2'/>" &
Concat(Sequence(_n),
"<text x='" & Text(Int(8 + (Value - 0.5)*_slot)) &
"' y='168' text-anchor='middle' font-family='Arial,sans-serif' font-size='11' fill='#94a3b8'>" &
Left(Index(colLineChartData, Value).month, 3) & "</text>"
) &
"</svg>"
)
)
)
- galLineInteract:
Control: Gallery@2.15.0
Variant: Horizontal
Properties:
Fill: =RGBA(0, 0, 0, 0)
Height: =152
Items: =Sequence(CountRows(colLineChartData))
ShowScrollbar: =false
TemplatePadding: =0
TemplateSize: =416 / Max(1, CountRows(colLineChartData))
Width: =416
X: =12
Y: =80
Children:
- btnLineHit:
Control: Button@0.0.45
Properties:
Appearance: ='ButtonCanvas.Appearance'.Transparent
Height: =Parent.TemplateHeight
OnSelect: =If(varTooltipLineIdx = ThisItem.Value, Set(varTooltipLineIdx, 0), Set(varTooltipLineIdx, ThisItem.Value))
Text: =""
Width: =Parent.TemplateWidth
X: =0
Y: =0
- conLineTooltip:
Control: GroupContainer@1.5.0
Variant: ManualLayout
Properties:
BorderColor: =RGBA(226, 232, 240, 1)
BorderStyle: =BorderStyle.Solid
BorderThickness: =1
DropShadow: =DropShadow.Regular
Fill: =RGBA(255, 255, 255, 1)
Height: =50
RadiusBottomLeft: =8
RadiusBottomRight: =8
RadiusTopLeft: =8
RadiusTopRight: =8
Visible: =varTooltipLineIdx > 0
Width: =110
X: =Max(20, Min(320, 20 + (varTooltipLineIdx - 0.5) * (400 / Max(1, CountRows(colLineChartData))) - 55))
Y: =Max(76, Int(224 - Index(colLineChartData, Max(1, varTooltipLineIdx)).Value / Max(1, Max(colLineChartData, Value)) * 144) - 25)
Children:
- lblTooltipLineMonth:
Control: Label@2.5.1
Properties:
Color: =RGBA(100, 116, 139, 1)
Font: =Font.'Open Sans'
Height: =18
Size: =10
Text: =If(varTooltipLineIdx > 0, Index(colLineChartData, varTooltipLineIdx).month, "")
Width: =100
X: =8
Y: =5
- imgTooltipLineDot:
Control: Image@2.2.3
Properties:
Fill: =RGBA(59, 130, 246, 1)
Height: =8
Image: =Blank()
RadiusBottomLeft: =4
RadiusBottomRight: =4
RadiusTopLeft: =4
RadiusTopRight: =4
Width: =3
X: =8
Y: =28
- lblTooltipLineValue:
Control: Label@2.5.1
Properties:
Color: =RGBA(15, 23, 42, 1)
Font: =Font.'Open Sans'
FontWeight: =FontWeight.Semibold
Height: =18
Size: =11
Text: =If(varTooltipLineIdx > 0, Text(Index(colLineChartData, varTooltipLineIdx).Value), "")
Width: =90
X: =16
Y: =26
- rectLineFooterLine:
Control: Rectangle@2.3.0
Properties:
Fill: =RGBA(226, 232, 240, 1)
Height: =1
Width: =440
X: =0
Y: =252
- lblLineTrend:
Control: Label@2.5.1
Properties:
Color: =RGBA(15, 23, 42, 1)
Font: =Font.'Open Sans'
FontWeight: =FontWeight.Semibold
Height: =20
Size: =12
Text: ="Trending up by 5.2% this month"
Width: =400
X: =20
Y: =262
- lblLineDateRange:
Control: Label@2.5.1
Properties:
Color: =RGBA(100, 116, 139, 1)
Font: =Font.'Open Sans'
Height: =20
Size: =11
Text: ="Showing total visitors for the last 6 months"
Width: =400
X: =20
Y: =286Implementation
Copies the customized component code directly to your clipboard. Use Ctrl+V in Power Apps Studio.
Something not pasting right? Troubleshooting guide