Skip to content

excel chart line

zmworm edited this page Apr 29, 2026 · 15 revisions

Excel: Chart - line

A dedicated page for the line chart type. Line charts connect data points with straight or smooth lines and are the go-to for time series, trend analysis, and multi-series comparison. Line charts support the richest set of decorative elements in the OOXML spec: markers, dash patterns, smooth curves, drop lines, high-low lines, up-down bars, data tables, reference lines, and dual axes.

Path: /{SheetName}/chart[N]

Add command shape:

officecli add data.xlsx /Sheet1 --type chart \
  --prop chartType=line \
  --prop title="Monthly Trends" \
  --prop series1="Revenue:100,200,300,400" \
  --prop categories="Q1,Q2,Q3,Q4" \
  <styling props>

See also: Chart - add, Chart - set, and the full runnable demo at examples/excel/charts-line.md (7 sheets x 28 charts covering every knob on this page).

Chart type variants

Type string OOXML element Description
line c:lineChart Standard overlapping lines
lineStacked c:lineChart (grouping=stacked) Lines stacked on top of each other
linePercentStacked c:lineChart (grouping=percentStacked) Stacked as percentage (0-100%)
line3d c:line3DChart 3D perspective line chart

Line appearance

Line width

Property Default Notes
lineWidth 2 pt Line thickness in points. Applies to all series.
series{N}.lineWidth Per-series override. E.g. series1.lineWidth=3

Internally stored as EMU (1 pt = 12,700 EMU) in a:ln/@w.

# Thick lines
officecli add data.xlsx /Sheet1 --type chart \
  --prop chartType=line \
  --prop series1="A:10,20,30" --prop categories="Q1,Q2,Q3" \
  --prop lineWidth=3

# Per-series widths via set
officecli set data.xlsx /Sheet1/chart[1] --prop series1.lineWidth=1 --prop series2.lineWidth=3

Line dash patterns

Property Default Notes
lineDash / dash solid Applies to all series
series{N}.lineDash Per-series override
Dash value SVG equivalent Visual
solid none ————
dot / sysDot 1,2 . . . . .
dash / sysDash 5,3 - - - -
dashDot / sysDashDot 5,3,1,3 - . - .
longDash / lgDash 8,3 — — —
longDashDot / lgDashDot 8,3,1,3 — . — .
longDashDotDot / lgDashDotDot 8,3,1,3,1,3 — . . — . .
officecli add data.xlsx /Sheet1 --type chart \
  --prop chartType=line \
  --prop series1="Actual:100,200,300" \
  --prop series2="Forecast:150,250,350" \
  --prop categories="Q1,Q2,Q3" \
  --prop lineDash=dash

# Mix: solid actual + dashed forecast
officecli set data.xlsx /Sheet1/chart[1] \
  --prop series1.lineDash=solid \
  --prop series2.lineDash=dash

Smooth curves

Property Default Notes
smooth false Spline interpolation. Applies to all series.
series{N}.smooth Per-series override (rarely used)

When enabled, data points are connected with Catmull-Rom cubic Bezier curves instead of straight line segments. The HTML preview faithfully renders the smooth path via SVG <path> with cubic Bezier commands.

officecli add data.xlsx /Sheet1 --type chart \
  --prop chartType=line \
  --prop smooth=true \
  --prop series1="Trend:80,120,115,140,135,160" \
  --prop categories="Jan,Feb,Mar,Apr,May,Jun"

Transparency and opacity

Property Default Notes
transparency 0 Series transparency (0-100%)
opacity / alpha 100 Series opacity (0-100%)
# Translucent lines for background context
officecli set data.xlsx /Sheet1/chart[1] --prop transparency=40

Markers

Property Default Notes
showMarker / showMarkers true Toggle marker visibility for the entire chart
marker / markers Chart-level marker: "style", "style:size", or "style:size:color"
series{N}.marker Per-series marker override
series{N}.markerSize Per-series marker size

Marker styles

circle (default), diamond, square, triangle, star, x, plus, dash, dot, none

# Diamond markers, size 8
officecli add data.xlsx /Sheet1 --type chart \
  --prop chartType=line \
  --prop series1="Data:10,20,30" --prop categories="A,B,C" \
  --prop marker="diamond:8"

# Per-series: circles for actuals, none for forecast
officecli set data.xlsx /Sheet1/chart[1] \
  --prop series1.marker="circle:6:4472C4" \
  --prop series2.marker=none

# Hide all markers
officecli set data.xlsx /Sheet1/chart[1] --prop showMarker=false

Line elements (line chart decorations)

These elements are unique to line and stock charts. They add vertical connectors, range indicators, and gain/loss bars between series.

Property Default Notes
dropLines false Vertical lines from each data point down to the X axis
hiLowLines false Vertical lines connecting the highest and lowest series values at each category
upDownBars false Gain/loss bars between the first and last series
serLines / seriesLines false Series connector lines (stacked bar / pie-of-pie)
# Drop lines — visual anchoring to the X axis
officecli add data.xlsx /Sheet1 --type chart \
  --prop chartType=line \
  --prop series1="East:120,135,148,162" \
  --prop series2="West:95,108,115,128" \
  --prop categories="Q1,Q2,Q3,Q4" \
  --prop dropLines=true

# High-low lines — stock chart style range display
officecli add data.xlsx /Sheet1 --type chart \
  --prop chartType=line \
  --prop series1="High:150,165,140,170" \
  --prop series2="Low:100,110,95,120" \
  --prop categories="Q1,Q2,Q3,Q4" \
  --prop hiLowLines=true

# Up-down (gain/loss) bars between open and close
officecli add data.xlsx /Sheet1 --type chart \
  --prop chartType=line \
  --prop series1="Open:120,135,148,130" \
  --prop series2="Close:135,128,162,145" \
  --prop categories="Mon,Tue,Wed,Thu" \
  --prop upDownBars=true

Line element styling: Drop lines, high-low lines, and up-down bars each carry their own spPr for color, width, and dash pattern. These are extracted from OOXML and faithfully rendered in the HTML preview. Up-down bar fill colors default to green (#4CAF50) for gains and red (#F44336) for losses when not specified in the OOXML.

Data table

Property Default Notes
dataTable false Show a table of raw values below the chart
dataTable.showHorzBorder true Horizontal border lines
dataTable.showVertBorder true Vertical border lines
dataTable.showOutline true Outer border
dataTable.showKeys true Legend color keys in the first column
officecli add data.xlsx /Sheet1 --type chart \
  --prop chartType=line \
  --prop series1="East:120,135,148" \
  --prop series2="West:95,108,115" \
  --prop categories="Q1,Q2,Q3" \
  --prop dataTable=true

Axis features

Scale control

Property Default Notes
axisMin / min (auto) Value axis lower bound
axisMax / max (auto) Value axis upper bound
majorUnit (auto) Major gridline / tick interval
minorUnit (auto) Minor gridline / tick interval
axisNumFmt / axisNumberFormat General Number format for tick labels (e.g. "$#,##0", "0%")
# Lock Y axis to 80-220, gridlines every 20
officecli add data.xlsx /Sheet1 --type chart \
  --prop chartType=line \
  --prop series1="Data:95,120,148,162,155,178" \
  --prop categories="Jan,Feb,Mar,Apr,May,Jun" \
  --prop axisMin=80 --prop axisMax=220 --prop majorUnit=20

Logarithmic scale

Property Default Notes
logBase / logScale Logarithmic scale base (e.g. 10)

Converts the value axis to logarithmic spacing. The HTML preview renders log-scale correctly with power-of-base tick marks.

officecli add data.xlsx /Sheet1 --type chart \
  --prop chartType=line \
  --prop series1="Growth:1,10,100,1000,10000" \
  --prop categories="Y1,Y2,Y3,Y4,Y5" \
  --prop logBase=10

Reversed axis

Property Default Notes
axisOrientation / axisReverse minMax Set to maxMin or true to flip the Y axis
# Depth chart: 0 at top, deeper values at bottom
officecli add data.xlsx /Sheet1 --type chart \
  --prop chartType=line \
  --prop series1="Depth:10,25,40,55" \
  --prop categories="A,B,C,D" \
  --prop axisReverse=true

Dual axis (secondary axis)

Property Default Notes
secondaryAxis / secondary Comma-separated 1-based series indices for secondary Y axis
# Revenue on left axis, growth rate on right axis
officecli add data.xlsx /Sheet1 --type chart \
  --prop chartType=line \
  --prop series1="Revenue:100,200,300,400" \
  --prop series2="Growth %:5,8,12,15" \
  --prop categories="Q1,Q2,Q3,Q4" \
  --prop secondaryAxis=2

Display units

Property Default Notes
dispUnits / displayUnits thousands, millions, billions, etc.

Axis visibility and styling

Property Default Notes
axisVisible / axis.visible true Show/hide both axes
axisLine / axis.line Value axis line: "color:width:dash"
catAxisLine Category axis line: "color:width:dash"
majorTickMark / majorTick out, in, cross, none
minorTickMark / minorTick Same as major tick
tickLabelPos nextTo nextTo, high, low, none

Gridlines

Property Default Notes
gridlines / majorGridlines true Toggle or configure: true, false/none, or "color:widthPt:dash"
minorGridlines false Same format as gridlines
# Custom gridlines: light gray, thin, dotted
officecli add data.xlsx /Sheet1 --type chart \
  --prop chartType=line \
  --prop series1="Data:100,200,300" --prop categories="A,B,C" \
  --prop "gridlines=D0D0D0:0.5:sysDot" \
  --prop "minorGridlines=EEEEEE:0.3:sysDot"

Reference lines (target / threshold overlays)

Property Default Notes
referenceLine / refLine value or "value:color:width:dash"

Reference lines are horizontal overlays drawn at a constant value. They appear in the legend and are rendered in the HTML preview with the correct dash pattern.

# Target line at 150 — red, dashed
officecli add data.xlsx /Sheet1 --type chart \
  --prop chartType=line \
  --prop series1="Actual:120,135,148,162" \
  --prop categories="Q1,Q2,Q3,Q4" \
  --prop "referenceLine=150:FF0000:1.5:dash"

Title styling

Property Default Notes
title Chart title text
title.font / titleFont Font family
title.size / titleSize Font size (pt)
title.color / titleColor Font color (hex)
title.bold / titleBold Bold (true/false)
title.glow / titleGlow Glow: "COLOR-RADIUS-OPACITY" or "none"
title.shadow / titleShadow Shadow: "COLOR-BLUR-ANGLE-DIST-OPACITY" or "none"

Legend

Property Default Notes
legend true Position: top, bottom, left, right, none
legend.overlay false Float legend on top of the chart
legendFont / legend.font "size:color:fontname"

Fills and borders

Property Default Notes
plotFill / plotAreaFill Plot area background: hex, gradient "C1-C2[:angle]", or "none"
chartFill / chartAreaFill Chart area background
plotArea.border / plotBorder Plot area outline: "color:width:dash" or "none"
chartArea.border / chartBorder Chart area outline
areaFill / area.fill Area gradient fill for area-style rendering

Series shadow and outline

Property Default Notes
series.shadow / seriesShadow "COLOR-BLUR-ANGLE-DIST-OPACITY" or "none"
series.outline / seriesOutline "COLOR-WIDTH" e.g. "FFFFFF-0.5" or "none"

Layout control

Property Default Notes
x, y 0 Chart position (column/row index)
width 8 Chart width (column units)
height 15 Chart height (row units)
plotArea.x/y/w/h Manual plot area layout (0-1 decimal)
title.x/y/w/h Manual title layout
legend.x/y/w/h Manual legend layout

Display blanks

Property Default Notes
dispBlanksAs / blanksAs gap How blank cells are handled: gap, zero, span/connect

Data labels

Property Default Notes
dataLabels false Toggle data labels
labelPos / labelPosition Position: center, insideEnd, insideBase, outsideEnd, top, bottom, left, right, bestFit
labelFont "size:color:bold"
dataLabel{N}.text Custom text for individual label
dataLabel{N}.x/y/w/h Manual layout of individual label
dataLabel{N}.delete Hide individual label
dataLabels.separator Separator between label parts
dataLabels.numFmt Number format for labels

Conditional coloring

Property Default Notes
colorRule / conditionalColor Color data points conditionally
point{N}.color Individual data point color (hex)

3D settings

Property Default Notes
view3d / camera / perspective "rotX,rotY,perspective" e.g. "15,20,30"

Applies only to line3d chart type.

Full example: presentation-grade line chart

officecli add data.xlsx /Sheet1 --type chart \
  --prop chartType=line \
  --prop title="Regional Sales Trend" \
  --prop title.size=16 --prop title.bold=true \
  --prop title.font="Arial" --prop title.color=1F2937 \
  --prop series1.name=East --prop series1.values="Sheet1!B2:B13" \
  --prop series2.name=South --prop series2.values="Sheet1!C2:C13" \
  --prop series3.name=North --prop series3.values="Sheet1!D2:D13" \
  --prop series1.categories="Sheet1!A2:A13" \
  --prop colors="4472C4,ED7D31,70AD47" \
  --prop smooth=true --prop lineWidth=2.5 \
  --prop marker="circle:6" \
  --prop "gridlines=E5E7EB:0.5:solid" \
  --prop "minorGridlines=F3F4F6:0.3:sysDot" \
  --prop axisTitle="Revenue ($K)" --prop catTitle="Month" \
  --prop "axisfont=10:6B7280:Arial" \
  --prop plotFill=FAFBFC \
  --prop "referenceLine=150:FF0000:1:dash" \
  --prop legend=bottom \
  --prop "legendfont=9:6B7280:Arial" \
  --prop x=0 --prop y=0 --prop width=14 --prop height=20

HTML preview support

The officecli HTML preview (officecli view data.xlsx html) renders the following line chart features:

Feature Preview Notes
Straight lines Yes <polyline>
Smooth curves Yes Catmull-Rom to cubic Bezier <path>
Dash patterns Yes stroke-dasharray
Per-series line width Yes stroke-width from OOXML
Marker shapes Yes 10 shapes: circle, diamond, square, triangle, star, x, plus, dash, dot, none
Drop lines Yes Vertical lines with OOXML color/width/dash
High-low lines Yes Vertical connectors with OOXML color/width
Up-down bars Yes Gain/loss bars with OOXML fill colors
Reference lines Yes Dashed overlays with legend entry
Data table Yes HTML table below chart
Log scale Yes Logarithmic Y axis spacing
Reversed axis Yes Inverted Y direction
Data labels Yes Value text above points
Custom axis scale Yes axisMin/axisMax/majorUnit
Gridlines Yes Color, width, dash from OOXML
3D perspective No Falls back to 2D rendering
Shadow effects No Decorative; not rendered
Glow effects No Decorative; not rendered

Known quirks

  • smooth is chart-level AND per-series. The chart-level smooth sets the default; individual series can override it. When reading back via get, both the chart-level and per-series values are reported.
  • 3D line charts fall back to 2D in preview. line3d is rendered as a flat 2D line chart in the HTML preview. Use Excel for 3D QA.
  • Stacked line type is set at creation. You cannot change a line to lineStacked via set — recreate the chart with the desired type.

Inspect an existing line chart

# List all charts
officecli query charts-line.xlsx chart

# Inspect a specific chart (shows all series with lineWidth, lineDash, smooth, marker, etc.)
officecli get charts-line.xlsx "/1-Line Fundamentals/chart[1]"

# Render to HTML preview
officecli view charts-line.xlsx html > preview.html

See Also

  • Chart - Overview of chart operations
  • Chart add - Generic chart add (all types)
  • Chart set - Modify existing charts
  • Chart get - Read back chart properties
  • charts-line example - Runnable py/md/xlsx triad: 7 sheets x 28 line charts covering every knob on this page

Based on OfficeCLI v1.0.64

Clone this wiki locally