[{"data":1,"prerenderedAt":2062},["ShallowReactive",2],{"doc:\u002Fformatting-and-charting-excel-reports-with-python\u002Fcreating-charts-in-excel-with-openpyxl\u002Fcreate-an-area-chart-with-openpyxl":3,"surround:\u002Fformatting-and-charting-excel-reports-with-python\u002Fcreating-charts-in-excel-with-openpyxl\u002Fcreate-an-area-chart-with-openpyxl":2028,"ancestors:\u002Fformatting-and-charting-excel-reports-with-python\u002Fcreating-charts-in-excel-with-openpyxl\u002Fcreate-an-area-chart-with-openpyxl":2037,"children:\u002Fformatting-and-charting-excel-reports-with-python\u002Fcreating-charts-in-excel-with-openpyxl\u002Fcreate-an-area-chart-with-openpyxl":2042,"related:\u002Fformatting-and-charting-excel-reports-with-python\u002Fcreating-charts-in-excel-with-openpyxl\u002Fcreate-an-area-chart-with-openpyxl":2043},{"id":4,"title":5,"body":6,"dateModified":1995,"datePublished":1995,"description":1996,"extension":1997,"faq":1998,"keyword":2007,"kind":2008,"meta":2009,"navigation":216,"path":2017,"seo":2018,"slug":2021,"stem":2022,"topics":2023,"type":2026,"__hash__":2027},"docs\u002Fformatting-and-charting-excel-reports-with-python\u002Fcreating-charts-in-excel-with-openpyxl\u002Fcreate-an-area-chart-with-openpyxl\u002Findex.md","Create an Area Chart in Excel with openpyxl",{"type":7,"value":8,"toc":1981},"minimark",[9,19,134,139,165,168,172,175,861,871,875,882,986,989,993,996,1126,1133,1278,1282,1289,1440,1459,1576,1580,1583,1773,1791,1795,1814,1818,1872,1876,1879,1883,1916,1920,1926,1932,1938,1944,1948,1977],[10,11,12,13,18],"p",{},"An area chart is a line chart with the space below each line filled in. The fill turns the chart from \"how did each value move?\" into \"how big is it, and what is it made of?\" — which is why area charts suit totals that build up from parts: revenue by region over a year, hours by project over a quarter, inventory by warehouse. Stacked, the layers show both the total and its composition; stacked to 100%, they show how the mix changes. This page, part of ",[14,15,17],"a",{"href":16},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fcreating-charts-in-excel-with-openpyxl\u002F","Creating Charts in Excel with openpyxl",", builds all three with openpyxl, including the one setting without which Excel shows the chart with no axes.",[20,21,29,30,29,34,29,38,29,46,29,54,29,61,29,68,29,71,29,75,29,80,29,86,29,88,29,93,29,95,29,98,29,101,29,105,29,107,29,111,29,113,29,116,29,119,29,123,29,125,29,129,29,131],"svg",{"viewBox":22,"role":23,"ariaLabelledBy":24,"xmlns":27,"style":28},"4 0 752 174","img",[25,26],"area-kinds-t","area-kinds-d","http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg","width:100%;max-width:752px;height:auto;display:block;margin:1.5rem auto;font-family:Inter,ui-sans-serif,system-ui,sans-serif","\n  ",[31,32,33],"title",{"id":25},"Three kinds of area chart and what each shows",[35,36,37],"desc",{"id":26},"A table of area chart groupings. Standard draws each series from zero, so areas overlap and later series can hide earlier ones; it suits comparing two or three series. Stacked puts each series on top of the one before, so the top edge is the total; it suits showing a total and its parts. Percent stacked scales every period to 100 percent; it suits showing how the mix changes when the total does not matter.",[39,40],"rect",{"x":41,"y":42,"width":43,"height":44,"fill":45},"4","0","752","174","#ffffff",[39,47],{"x":48,"y":49,"width":50,"height":51,"rx":42,"fill":45,"stroke":52,"style":53},"20.0","16.0","119.0","40.0","var(--line,#cdd5e6)","stroke-width:1px",[39,55],{"x":56,"y":49,"width":57,"height":51,"rx":42,"fill":58,"stroke":59,"style":60},"139.0","300.5","#f0f4ff","var(--brand,#5b5cf0)","stroke-width:1.2px",[62,63,67],"text",{"x":64,"y":65,"style":66},"289.2","41.0","font-size:13px;font-weight:700;fill:var(--brand-strong,#4338ca);text-anchor:middle","grouping",[39,69],{"x":70,"y":49,"width":57,"height":51,"rx":42,"fill":58,"stroke":59,"style":60},"439.5",[62,72,74],{"x":73,"y":65,"style":66},"589.7","Best for",[39,76],{"x":48,"y":77,"width":50,"height":78,"rx":42,"fill":79,"stroke":52,"style":53},"56.0","34.0","#e7ebef",[62,81,85],{"x":82,"y":83,"style":84},"32.0","78.0","font-size:12.5px;font-weight:700;fill:var(--text,#172033);text-anchor:start","Standard",[39,87],{"x":56,"y":77,"width":57,"height":78,"rx":42,"fill":45,"stroke":52,"style":53},[62,89,92],{"x":64,"y":90,"style":91},"77.0","font-size:11.5px;font-weight:400;fill:var(--text,#172033);text-anchor:middle","\"standard\"",[39,94],{"x":70,"y":77,"width":57,"height":78,"rx":42,"fill":45,"stroke":52,"style":53},[62,96,97],{"x":73,"y":90,"style":91},"comparing 2–3 series",[39,99],{"x":48,"y":100,"width":50,"height":78,"rx":42,"fill":79,"stroke":52,"style":53},"90.0",[62,102,104],{"x":82,"y":103,"style":84},"112.0","Stacked",[39,106],{"x":56,"y":100,"width":57,"height":78,"rx":42,"fill":45,"stroke":52,"style":53},[62,108,110],{"x":64,"y":109,"style":91},"111.0","\"stacked\"",[39,112],{"x":70,"y":100,"width":57,"height":78,"rx":42,"fill":45,"stroke":52,"style":53},[62,114,115],{"x":73,"y":109,"style":91},"total and its parts",[39,117],{"x":48,"y":118,"width":50,"height":78,"rx":42,"fill":79,"stroke":52,"style":53},"124.0",[62,120,122],{"x":82,"y":121,"style":84},"146.0","100% stacked",[39,124],{"x":56,"y":118,"width":57,"height":78,"rx":42,"fill":45,"stroke":52,"style":53},[62,126,128],{"x":64,"y":127,"style":91},"145.0","\"percentStacked\"",[39,130],{"x":70,"y":118,"width":57,"height":78,"rx":42,"fill":45,"stroke":52,"style":53},[62,132,133],{"x":73,"y":127,"style":91},"how the mix changes",[135,136,138],"h2",{"id":137},"prerequisites","Prerequisites",[140,141,146],"pre",{"className":142,"code":143,"language":144,"meta":145,"style":145},"language-bash shiki shiki-themes github-light github-dark-high-contrast","pip install openpyxl\n","bash","",[147,148,149],"code",{"__ignoreMap":145},[150,151,154,158,162],"span",{"class":152,"line":153},"line",1,[150,155,157],{"class":156},"sMTad","pip",[150,159,161],{"class":160},"srMev"," install",[150,163,164],{"class":160}," openpyxl\n",[10,166,167],{},"The examples use twelve months of revenue for three regions, written to the sheet first so the chart can reference it.",[135,169,171],{"id":170},"step-1-write-the-data-and-a-standard-area-chart","Step 1 — Write the data and a standard area chart",[10,173,174],{},"Charts in openpyxl reference cells, so the data goes on the sheet first — one column per series, with the series names in the header row and the categories in the first column:",[140,176,180],{"className":177,"code":178,"language":179,"meta":145,"style":145},"language-python shiki shiki-themes github-light github-dark-high-contrast","from openpyxl import Workbook\nfrom openpyxl.chart import AreaChart, Reference\n\nmonths = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\nnorth = [42, 45, 48, 51, 55, 58, 54, 52, 60, 63, 66, 72]\nsouth = [30, 31, 35, 34, 38, 41, 44, 47, 45, 49, 52, 55]\neast = [12, 14, 15, 18, 20, 22, 25, 27, 30, 33, 35, 40]\n\nwb = Workbook(); ws = wb.active; ws.title = \"Revenue\"\nws.append([\"Month\", \"North\", \"South\", \"East\"])\nfor row in zip(months, north, south, east):\n    ws.append(row)\n\ndef area_chart(title, grouping=\"standard\"):\n    chart = AreaChart()\n    chart.title = title\n    chart.grouping = grouping\n    if grouping != \"standard\":\n        chart.overlap = 100\n    chart.add_data(Reference(ws, min_col=2, max_col=4, min_row=1, max_row=13), titles_from_data=True)\n    chart.set_categories(Reference(ws, min_col=1, min_row=2, max_row=13))\n    chart.y_axis.title = \"Revenue (k)\"\n    chart.x_axis.delete = False\n    chart.y_axis.delete = False\n    chart.width, chart.height = 18, 9\n    return chart\n\nstandard = area_chart(\"Revenue by region\")\nws.add_chart(standard, \"F2\")\nprint(len(standard.series), \"series,\", standard.grouping)\n","python",[147,181,182,198,211,218,292,363,430,498,503,524,551,569,575,580,600,611,622,633,651,662,720,751,762,773,783,799,808,813,829,840],{"__ignoreMap":145},[150,183,184,188,192,195],{"class":152,"line":153},[150,185,187],{"class":186},"s-kum","from",[150,189,191],{"class":190},"skGVy"," openpyxl ",[150,193,194],{"class":186},"import",[150,196,197],{"class":190}," Workbook\n",[150,199,201,203,206,208],{"class":152,"line":200},2,[150,202,187],{"class":186},[150,204,205],{"class":190}," openpyxl.chart ",[150,207,194],{"class":186},[150,209,210],{"class":190}," AreaChart, Reference\n",[150,212,214],{"class":152,"line":213},3,[150,215,217],{"emptyLinePlaceholder":216},true,"\n",[150,219,221,224,227,230,233,236,239,241,244,246,249,251,254,256,259,261,264,266,269,271,274,276,279,281,284,286,289],{"class":152,"line":220},4,[150,222,223],{"class":190},"months ",[150,225,226],{"class":186},"=",[150,228,229],{"class":190}," [",[150,231,232],{"class":160},"\"Jan\"",[150,234,235],{"class":190},", ",[150,237,238],{"class":160},"\"Feb\"",[150,240,235],{"class":190},[150,242,243],{"class":160},"\"Mar\"",[150,245,235],{"class":190},[150,247,248],{"class":160},"\"Apr\"",[150,250,235],{"class":190},[150,252,253],{"class":160},"\"May\"",[150,255,235],{"class":190},[150,257,258],{"class":160},"\"Jun\"",[150,260,235],{"class":190},[150,262,263],{"class":160},"\"Jul\"",[150,265,235],{"class":190},[150,267,268],{"class":160},"\"Aug\"",[150,270,235],{"class":190},[150,272,273],{"class":160},"\"Sep\"",[150,275,235],{"class":190},[150,277,278],{"class":160},"\"Oct\"",[150,280,235],{"class":190},[150,282,283],{"class":160},"\"Nov\"",[150,285,235],{"class":190},[150,287,288],{"class":160},"\"Dec\"",[150,290,291],{"class":190},"]\n",[150,293,295,298,300,302,306,308,311,313,316,318,321,323,326,328,331,333,336,338,341,343,346,348,351,353,356,358,361],{"class":152,"line":294},5,[150,296,297],{"class":190},"north ",[150,299,226],{"class":186},[150,301,229],{"class":190},[150,303,305],{"class":304},"sP0c6","42",[150,307,235],{"class":190},[150,309,310],{"class":304},"45",[150,312,235],{"class":190},[150,314,315],{"class":304},"48",[150,317,235],{"class":190},[150,319,320],{"class":304},"51",[150,322,235],{"class":190},[150,324,325],{"class":304},"55",[150,327,235],{"class":190},[150,329,330],{"class":304},"58",[150,332,235],{"class":190},[150,334,335],{"class":304},"54",[150,337,235],{"class":190},[150,339,340],{"class":304},"52",[150,342,235],{"class":190},[150,344,345],{"class":304},"60",[150,347,235],{"class":190},[150,349,350],{"class":304},"63",[150,352,235],{"class":190},[150,354,355],{"class":304},"66",[150,357,235],{"class":190},[150,359,360],{"class":304},"72",[150,362,291],{"class":190},[150,364,366,369,371,373,376,378,381,383,386,388,391,393,396,398,401,403,406,408,411,413,415,417,420,422,424,426,428],{"class":152,"line":365},6,[150,367,368],{"class":190},"south ",[150,370,226],{"class":186},[150,372,229],{"class":190},[150,374,375],{"class":304},"30",[150,377,235],{"class":190},[150,379,380],{"class":304},"31",[150,382,235],{"class":190},[150,384,385],{"class":304},"35",[150,387,235],{"class":190},[150,389,390],{"class":304},"34",[150,392,235],{"class":190},[150,394,395],{"class":304},"38",[150,397,235],{"class":190},[150,399,400],{"class":304},"41",[150,402,235],{"class":190},[150,404,405],{"class":304},"44",[150,407,235],{"class":190},[150,409,410],{"class":304},"47",[150,412,235],{"class":190},[150,414,310],{"class":304},[150,416,235],{"class":190},[150,418,419],{"class":304},"49",[150,421,235],{"class":190},[150,423,340],{"class":304},[150,425,235],{"class":190},[150,427,325],{"class":304},[150,429,291],{"class":190},[150,431,433,436,438,440,443,445,448,450,453,455,458,460,463,465,468,470,473,475,478,480,482,484,487,489,491,493,496],{"class":152,"line":432},7,[150,434,435],{"class":190},"east ",[150,437,226],{"class":186},[150,439,229],{"class":190},[150,441,442],{"class":304},"12",[150,444,235],{"class":190},[150,446,447],{"class":304},"14",[150,449,235],{"class":190},[150,451,452],{"class":304},"15",[150,454,235],{"class":190},[150,456,457],{"class":304},"18",[150,459,235],{"class":190},[150,461,462],{"class":304},"20",[150,464,235],{"class":190},[150,466,467],{"class":304},"22",[150,469,235],{"class":190},[150,471,472],{"class":304},"25",[150,474,235],{"class":190},[150,476,477],{"class":304},"27",[150,479,235],{"class":190},[150,481,375],{"class":304},[150,483,235],{"class":190},[150,485,486],{"class":304},"33",[150,488,235],{"class":190},[150,490,385],{"class":304},[150,492,235],{"class":190},[150,494,495],{"class":304},"40",[150,497,291],{"class":190},[150,499,501],{"class":152,"line":500},8,[150,502,217],{"emptyLinePlaceholder":216},[150,504,506,509,511,514,516,519,521],{"class":152,"line":505},9,[150,507,508],{"class":190},"wb ",[150,510,226],{"class":186},[150,512,513],{"class":190}," Workbook(); ws ",[150,515,226],{"class":186},[150,517,518],{"class":190}," wb.active; ws.title ",[150,520,226],{"class":186},[150,522,523],{"class":160}," \"Revenue\"\n",[150,525,527,530,533,535,538,540,543,545,548],{"class":152,"line":526},10,[150,528,529],{"class":190},"ws.append([",[150,531,532],{"class":160},"\"Month\"",[150,534,235],{"class":190},[150,536,537],{"class":160},"\"North\"",[150,539,235],{"class":190},[150,541,542],{"class":160},"\"South\"",[150,544,235],{"class":190},[150,546,547],{"class":160},"\"East\"",[150,549,550],{"class":190},"])\n",[150,552,554,557,560,563,566],{"class":152,"line":553},11,[150,555,556],{"class":186},"for",[150,558,559],{"class":190}," row ",[150,561,562],{"class":186},"in",[150,564,565],{"class":304}," zip",[150,567,568],{"class":190},"(months, north, south, east):\n",[150,570,572],{"class":152,"line":571},12,[150,573,574],{"class":190},"    ws.append(row)\n",[150,576,578],{"class":152,"line":577},13,[150,579,217],{"emptyLinePlaceholder":216},[150,581,583,586,590,593,595,597],{"class":152,"line":582},14,[150,584,585],{"class":186},"def",[150,587,589],{"class":588},"s_Opv"," area_chart",[150,591,592],{"class":190},"(title, grouping",[150,594,226],{"class":186},[150,596,92],{"class":160},[150,598,599],{"class":190},"):\n",[150,601,603,606,608],{"class":152,"line":602},15,[150,604,605],{"class":190},"    chart ",[150,607,226],{"class":186},[150,609,610],{"class":190}," AreaChart()\n",[150,612,614,617,619],{"class":152,"line":613},16,[150,615,616],{"class":190},"    chart.title ",[150,618,226],{"class":186},[150,620,621],{"class":190}," title\n",[150,623,625,628,630],{"class":152,"line":624},17,[150,626,627],{"class":190},"    chart.grouping ",[150,629,226],{"class":186},[150,631,632],{"class":190}," grouping\n",[150,634,636,639,642,645,648],{"class":152,"line":635},18,[150,637,638],{"class":186},"    if",[150,640,641],{"class":190}," grouping ",[150,643,644],{"class":186},"!=",[150,646,647],{"class":160}," \"standard\"",[150,649,650],{"class":190},":\n",[150,652,654,657,659],{"class":152,"line":653},19,[150,655,656],{"class":190},"        chart.overlap ",[150,658,226],{"class":186},[150,660,661],{"class":304}," 100\n",[150,663,665,668,672,674,677,679,682,684,686,688,691,693,696,698,701,703,706,709,712,714,717],{"class":152,"line":664},20,[150,666,667],{"class":190},"    chart.add_data(Reference(ws, ",[150,669,671],{"class":670},"sa561","min_col",[150,673,226],{"class":186},[150,675,676],{"class":304},"2",[150,678,235],{"class":190},[150,680,681],{"class":670},"max_col",[150,683,226],{"class":186},[150,685,41],{"class":304},[150,687,235],{"class":190},[150,689,690],{"class":670},"min_row",[150,692,226],{"class":186},[150,694,695],{"class":304},"1",[150,697,235],{"class":190},[150,699,700],{"class":670},"max_row",[150,702,226],{"class":186},[150,704,705],{"class":304},"13",[150,707,708],{"class":190},"), ",[150,710,711],{"class":670},"titles_from_data",[150,713,226],{"class":186},[150,715,716],{"class":304},"True",[150,718,719],{"class":190},")\n",[150,721,723,726,728,730,732,734,736,738,740,742,744,746,748],{"class":152,"line":722},21,[150,724,725],{"class":190},"    chart.set_categories(Reference(ws, ",[150,727,671],{"class":670},[150,729,226],{"class":186},[150,731,695],{"class":304},[150,733,235],{"class":190},[150,735,690],{"class":670},[150,737,226],{"class":186},[150,739,676],{"class":304},[150,741,235],{"class":190},[150,743,700],{"class":670},[150,745,226],{"class":186},[150,747,705],{"class":304},[150,749,750],{"class":190},"))\n",[150,752,754,757,759],{"class":152,"line":753},22,[150,755,756],{"class":190},"    chart.y_axis.title ",[150,758,226],{"class":186},[150,760,761],{"class":160}," \"Revenue (k)\"\n",[150,763,765,768,770],{"class":152,"line":764},23,[150,766,767],{"class":190},"    chart.x_axis.delete ",[150,769,226],{"class":186},[150,771,772],{"class":304}," False\n",[150,774,776,779,781],{"class":152,"line":775},24,[150,777,778],{"class":190},"    chart.y_axis.delete ",[150,780,226],{"class":186},[150,782,772],{"class":304},[150,784,786,789,791,794,796],{"class":152,"line":785},25,[150,787,788],{"class":190},"    chart.width, chart.height ",[150,790,226],{"class":186},[150,792,793],{"class":304}," 18",[150,795,235],{"class":190},[150,797,798],{"class":304},"9\n",[150,800,802,805],{"class":152,"line":801},26,[150,803,804],{"class":186},"    return",[150,806,807],{"class":190}," chart\n",[150,809,811],{"class":152,"line":810},27,[150,812,217],{"emptyLinePlaceholder":216},[150,814,816,819,821,824,827],{"class":152,"line":815},28,[150,817,818],{"class":190},"standard ",[150,820,226],{"class":186},[150,822,823],{"class":190}," area_chart(",[150,825,826],{"class":160},"\"Revenue by region\"",[150,828,719],{"class":190},[150,830,832,835,838],{"class":152,"line":831},29,[150,833,834],{"class":190},"ws.add_chart(standard, ",[150,836,837],{"class":160},"\"F2\"",[150,839,719],{"class":190},[150,841,843,846,849,852,855,858],{"class":152,"line":842},30,[150,844,845],{"class":304},"print",[150,847,848],{"class":190},"(",[150,850,851],{"class":304},"len",[150,853,854],{"class":190},"(standard.series), ",[150,856,857],{"class":160},"\"series,\"",[150,859,860],{"class":190},", standard.grouping)\n",[10,862,863,866,867,870],{},[147,864,865],{},"titles_from_data=True"," takes each series name from the header row, which is why the data reference starts at row 1. The two ",[147,868,869],{},"delete = False"," lines matter more than they look: openpyxl 3.1 leaves out the flag that marks an axis as visible, and Excel treats a missing flag as \"hidden\", so without them the chart appears in Excel with no axes at all. LibreOffice shows axes either way, which makes the problem easy to miss.",[135,872,874],{"id":873},"step-2-stack-the-areas","Step 2 — Stack the areas",[10,876,877,878,881],{},"In a standard area chart every series starts from zero, so the areas overlap, and a larger area can cover a smaller one completely — in this data, North's area hides South and East altogether. Stacking puts each series on top of the previous one: the layers show each region, and the top edge is the total. ",[147,879,880],{},"overlap = 100"," makes the layers sit exactly on each other:",[140,883,885],{"className":177,"code":884,"language":179,"meta":145,"style":145},"stacked = area_chart(\"Revenue by region — stacked\", grouping=\"stacked\")\nws.add_chart(stacked, \"F21\")\ntotals = [n + s + e for n, s, e in zip(north, south, east)]\nprint(\"total from\", totals[0], \"in Jan to\", totals[-1], \"in Dec\")\n",[147,886,887,909,919,952],{"__ignoreMap":145},[150,888,889,892,894,896,899,901,903,905,907],{"class":152,"line":153},[150,890,891],{"class":190},"stacked ",[150,893,226],{"class":186},[150,895,823],{"class":190},[150,897,898],{"class":160},"\"Revenue by region — stacked\"",[150,900,235],{"class":190},[150,902,67],{"class":670},[150,904,226],{"class":186},[150,906,110],{"class":160},[150,908,719],{"class":190},[150,910,911,914,917],{"class":152,"line":200},[150,912,913],{"class":190},"ws.add_chart(stacked, ",[150,915,916],{"class":160},"\"F21\"",[150,918,719],{"class":190},[150,920,921,924,926,929,932,935,937,940,942,945,947,949],{"class":152,"line":213},[150,922,923],{"class":190},"totals ",[150,925,226],{"class":186},[150,927,928],{"class":190}," [n ",[150,930,931],{"class":186},"+",[150,933,934],{"class":190}," s ",[150,936,931],{"class":186},[150,938,939],{"class":190}," e ",[150,941,556],{"class":186},[150,943,944],{"class":190}," n, s, e ",[150,946,562],{"class":186},[150,948,565],{"class":304},[150,950,951],{"class":190},"(north, south, east)]\n",[150,953,954,956,958,961,964,966,969,972,974,977,979,981,984],{"class":152,"line":220},[150,955,845],{"class":304},[150,957,848],{"class":190},[150,959,960],{"class":160},"\"total from\"",[150,962,963],{"class":190},", totals[",[150,965,42],{"class":304},[150,967,968],{"class":190},"], ",[150,970,971],{"class":160},"\"in Jan to\"",[150,973,963],{"class":190},[150,975,976],{"class":186},"-",[150,978,695],{"class":304},[150,980,968],{"class":190},[150,982,983],{"class":160},"\"in Dec\"",[150,985,719],{"class":190},[10,987,988],{},"The stacked chart's top edge rises from 84 in January to 167 in December, and East's growth from 12 to 40 is visible as a thickening layer. Put the steadiest series at the bottom — the first column — so the layers above it are easier to read; a jagged bottom layer makes every layer above it jagged too.",[135,990,992],{"id":991},"step-3-show-the-mix-with-100-stacking","Step 3 — Show the mix with 100% stacking",[10,994,995],{},"When the question is \"what share does each region contribute?\" rather than \"how big is the total?\", stack to 100%. Every month becomes a full-height column of shares, so changes in the mix are visible even while the total grows:",[140,997,999],{"className":177,"code":998,"language":179,"meta":145,"style":145},"share = area_chart(\"Share of revenue by region\", grouping=\"percentStacked\")\nshare.y_axis.title = \"Share of revenue\"\nshare.y_axis.number_format = \"0%\"\nws.add_chart(share, \"F40\")\nprint(f\"East share: {east[0] \u002F totals[0]:.0%} in Jan, {east[-1] \u002F totals[-1]:.0%} in Dec\")\n",[147,1000,1001,1023,1033,1043,1053],{"__ignoreMap":145},[150,1002,1003,1006,1008,1010,1013,1015,1017,1019,1021],{"class":152,"line":153},[150,1004,1005],{"class":190},"share ",[150,1007,226],{"class":186},[150,1009,823],{"class":190},[150,1011,1012],{"class":160},"\"Share of revenue by region\"",[150,1014,235],{"class":190},[150,1016,67],{"class":670},[150,1018,226],{"class":186},[150,1020,128],{"class":160},[150,1022,719],{"class":190},[150,1024,1025,1028,1030],{"class":152,"line":200},[150,1026,1027],{"class":190},"share.y_axis.title ",[150,1029,226],{"class":186},[150,1031,1032],{"class":160}," \"Share of revenue\"\n",[150,1034,1035,1038,1040],{"class":152,"line":213},[150,1036,1037],{"class":190},"share.y_axis.number_format ",[150,1039,226],{"class":186},[150,1041,1042],{"class":160}," \"0%\"\n",[150,1044,1045,1048,1051],{"class":152,"line":220},[150,1046,1047],{"class":190},"ws.add_chart(share, ",[150,1049,1050],{"class":160},"\"F40\"",[150,1052,719],{"class":190},[150,1054,1055,1057,1059,1062,1065,1069,1072,1074,1077,1080,1083,1085,1088,1091,1094,1097,1099,1101,1103,1105,1107,1109,1111,1113,1115,1117,1119,1121,1124],{"class":152,"line":294},[150,1056,845],{"class":304},[150,1058,848],{"class":190},[150,1060,1061],{"class":186},"f",[150,1063,1064],{"class":160},"\"East share: ",[150,1066,1068],{"class":1067},"sSjpA","{",[150,1070,1071],{"class":190},"east[",[150,1073,42],{"class":304},[150,1075,1076],{"class":190},"] ",[150,1078,1079],{"class":186},"\u002F",[150,1081,1082],{"class":190}," totals[",[150,1084,42],{"class":304},[150,1086,1087],{"class":190},"]",[150,1089,1090],{"class":186},":.0%",[150,1092,1093],{"class":1067},"}",[150,1095,1096],{"class":160}," in Jan, ",[150,1098,1068],{"class":1067},[150,1100,1071],{"class":190},[150,1102,976],{"class":186},[150,1104,695],{"class":304},[150,1106,1076],{"class":190},[150,1108,1079],{"class":186},[150,1110,1082],{"class":190},[150,1112,976],{"class":186},[150,1114,695],{"class":304},[150,1116,1087],{"class":190},[150,1118,1090],{"class":186},[150,1120,1093],{"class":1067},[150,1122,1123],{"class":160}," in Dec\"",[150,1125,719],{"class":190},[10,1127,1128,1129,1132],{},"East's share grows from 14% to 24% of the total — a change that is easy to miss in the stacked chart, where every layer is growing. The axis format ",[147,1130,1131],{},"0%"," labels the scale as percentages; openpyxl does the scaling itself, so no percentage columns are needed in the data.",[20,1134,29,1140,29,1143,29,1146,29,1150,29,1155,29,1160,29,1164,29,1168,29,1171,29,1174,29,1177,29,1180,29,1184,29,1189,29,1193,29,1197,29,1201,29,1205,29,1209,29,1213,29,1217,29,1221,29,1225,29,1229,29,1233,29,1239,29,1245,29,1248,29,1251,29,1254,29,1257,29,1260,29,1263,29,1266,29,1269,29,1272,29,1275],{"viewBox":1135,"role":23,"ariaLabelledBy":1136,"xmlns":27,"style":1139},"4 0 748 252",[1137,1138],"area-share-t","area-share-d","width:100%;max-width:748px;height:auto;display:block;margin:1.5rem auto;font-family:Inter,ui-sans-serif,system-ui,sans-serif",[31,1141,1142],{"id":1137},"East's share of revenue, January to December",[35,1144,1145],{"id":1138},"Line chart of East's share of total revenue by month, rising from 14 percent in January to 24 percent in December, the change the 100 percent stacked area chart makes visible.",[39,1147],{"x":41,"y":42,"width":1148,"height":1149,"fill":45},"748","252",[152,1151],{"x1":1152,"y1":1153,"x2":1154,"y2":1153,"stroke":52,"style":53},"46.4","214.0","736.0",[62,1156,42],{"x":1157,"y":1158,"style":1159},"27.2","218.0","font-size:11px;font-weight:400;fill:var(--muted,#5b6780);text-anchor:middle",[152,1161],{"x1":1152,"y1":1162,"x2":1154,"y2":1162,"stroke":52,"style":1163},"150.7","stroke-width:1px;stroke-dasharray:5 4",[62,1165,1167],{"x":1157,"y":1166,"style":1159},"154.7","10",[152,1169],{"x1":1152,"y1":1170,"x2":1154,"y2":1170,"stroke":52,"style":1163},"87.3",[62,1172,462],{"x":1157,"y":1173,"style":1159},"91.3",[152,1175],{"x1":1152,"y1":1176,"x2":1154,"y2":1176,"stroke":52,"style":1163},"24.0",[62,1178,375],{"x":1157,"y":1179,"style":1159},"28.0",[152,1181],{"x1":1152,"y1":1153,"x2":1154,"y2":1153,"stroke":1182,"style":1183},"var(--muted,#5b6780)","stroke-width:1.5px",[62,1185,1188],{"x":1186,"y":1187,"style":91},"75.2","232.0","Jan",[62,1190,1192],{"x":1191,"y":1187,"style":91},"132.6","Feb",[62,1194,1196],{"x":1195,"y":1187,"style":91},"190.1","Mar",[62,1198,1200],{"x":1199,"y":1187,"style":91},"247.6","Apr",[62,1202,1204],{"x":1203,"y":1187,"style":91},"305.0","May",[62,1206,1208],{"x":1207,"y":1187,"style":91},"362.5","Jun",[62,1210,1212],{"x":1211,"y":1187,"style":91},"419.9","Jul",[62,1214,1216],{"x":1215,"y":1187,"style":91},"477.4","Aug",[62,1218,1220],{"x":1219,"y":1187,"style":91},"534.9","Sep",[62,1222,1224],{"x":1223,"y":1187,"style":91},"592.3","Oct",[62,1226,1228],{"x":1227,"y":1187,"style":91},"649.8","Nov",[62,1230,1232],{"x":1231,"y":1187,"style":91},"707.3","Dec",[1234,1235],"path",{"d":1236,"fill":1237,"stroke":59,"style":1238},"M75.2,123.4 L132.6,115.2 L190.1,117.1 L247.6,103.2 L305.0,101.9 L362.5,98.7 L419.9,85.4 L477.4,78.5 L534.9,73.4 L592.3,69.6 L649.8,69.0 L707.3,62.0","none","stroke-width:2.5px;stroke-linejoin:round;stroke-linecap:round",[1240,1241],"circle",{"cx":1186,"cy":1242,"r":1243,"fill":45,"stroke":59,"style":1244},"123.4","4.0","stroke-width:2px",[1240,1246],{"cx":1191,"cy":1247,"r":1243,"fill":45,"stroke":59,"style":1244},"115.2",[1240,1249],{"cx":1195,"cy":1250,"r":1243,"fill":45,"stroke":59,"style":1244},"117.1",[1240,1252],{"cx":1199,"cy":1253,"r":1243,"fill":45,"stroke":59,"style":1244},"103.2",[1240,1255],{"cx":1203,"cy":1256,"r":1243,"fill":45,"stroke":59,"style":1244},"101.9",[1240,1258],{"cx":1207,"cy":1259,"r":1243,"fill":45,"stroke":59,"style":1244},"98.7",[1240,1261],{"cx":1211,"cy":1262,"r":1243,"fill":45,"stroke":59,"style":1244},"85.4",[1240,1264],{"cx":1215,"cy":1265,"r":1243,"fill":45,"stroke":59,"style":1244},"78.5",[1240,1267],{"cx":1219,"cy":1268,"r":1243,"fill":45,"stroke":59,"style":1244},"73.4",[1240,1270],{"cx":1223,"cy":1271,"r":1243,"fill":45,"stroke":59,"style":1244},"69.6",[1240,1273],{"cx":1227,"cy":1274,"r":1243,"fill":45,"stroke":59,"style":1244},"69.0",[1240,1276],{"cx":1231,"cy":1277,"r":1243,"fill":45,"stroke":59,"style":1244},"62.0",[135,1279,1281],{"id":1280},"step-4-make-overlapping-areas-see-through","Step 4 — Make overlapping areas see-through",[10,1283,1284,1285,1288],{},"A standard area chart can still work for two or three series if the fills are partly transparent, so a smaller series shows through a larger one. openpyxl accepts transparency on scheme colours — the workbook theme's accent colours — through an ",[147,1286,1287],{},"alpha"," value in thousandths of a percent:",[140,1290,1292],{"className":177,"code":1291,"language":179,"meta":145,"style":145},"from openpyxl.drawing.colors import ColorChoice, SchemeColor\n\nsee_through = area_chart(\"Revenue by region — overlapping\")\nfor series, accent in zip(see_through.series, [\"accent1\", \"accent2\", \"accent3\"]):\n    series.graphicalProperties.solidFill = ColorChoice(schemeClr=SchemeColor(val=accent, alpha=55000))\n    series.graphicalProperties.line.noFill = True\nws.add_chart(see_through, \"F59\")\nwb.save(\"area_charts.xlsx\")\nprint(\"saved\", len(ws._charts), \"charts\")\n",[147,1293,1294,1306,1310,1324,1354,1389,1399,1409,1419],{"__ignoreMap":145},[150,1295,1296,1298,1301,1303],{"class":152,"line":153},[150,1297,187],{"class":186},[150,1299,1300],{"class":190}," openpyxl.drawing.colors ",[150,1302,194],{"class":186},[150,1304,1305],{"class":190}," ColorChoice, SchemeColor\n",[150,1307,1308],{"class":152,"line":200},[150,1309,217],{"emptyLinePlaceholder":216},[150,1311,1312,1315,1317,1319,1322],{"class":152,"line":213},[150,1313,1314],{"class":190},"see_through ",[150,1316,226],{"class":186},[150,1318,823],{"class":190},[150,1320,1321],{"class":160},"\"Revenue by region — overlapping\"",[150,1323,719],{"class":190},[150,1325,1326,1328,1331,1333,1335,1338,1341,1343,1346,1348,1351],{"class":152,"line":220},[150,1327,556],{"class":186},[150,1329,1330],{"class":190}," series, accent ",[150,1332,562],{"class":186},[150,1334,565],{"class":304},[150,1336,1337],{"class":190},"(see_through.series, [",[150,1339,1340],{"class":160},"\"accent1\"",[150,1342,235],{"class":190},[150,1344,1345],{"class":160},"\"accent2\"",[150,1347,235],{"class":190},[150,1349,1350],{"class":160},"\"accent3\"",[150,1352,1353],{"class":190},"]):\n",[150,1355,1356,1359,1361,1364,1367,1369,1372,1375,1377,1380,1382,1384,1387],{"class":152,"line":294},[150,1357,1358],{"class":190},"    series.graphicalProperties.solidFill ",[150,1360,226],{"class":186},[150,1362,1363],{"class":190}," ColorChoice(",[150,1365,1366],{"class":670},"schemeClr",[150,1368,226],{"class":186},[150,1370,1371],{"class":190},"SchemeColor(",[150,1373,1374],{"class":670},"val",[150,1376,226],{"class":186},[150,1378,1379],{"class":190},"accent, ",[150,1381,1287],{"class":670},[150,1383,226],{"class":186},[150,1385,1386],{"class":304},"55000",[150,1388,750],{"class":190},[150,1390,1391,1394,1396],{"class":152,"line":365},[150,1392,1393],{"class":190},"    series.graphicalProperties.line.noFill ",[150,1395,226],{"class":186},[150,1397,1398],{"class":304}," True\n",[150,1400,1401,1404,1407],{"class":152,"line":432},[150,1402,1403],{"class":190},"ws.add_chart(see_through, ",[150,1405,1406],{"class":160},"\"F59\"",[150,1408,719],{"class":190},[150,1410,1411,1414,1417],{"class":152,"line":500},[150,1412,1413],{"class":190},"wb.save(",[150,1415,1416],{"class":160},"\"area_charts.xlsx\"",[150,1418,719],{"class":190},[150,1420,1421,1423,1425,1428,1430,1432,1435,1438],{"class":152,"line":505},[150,1422,845],{"class":304},[150,1424,848],{"class":190},[150,1426,1427],{"class":160},"\"saved\"",[150,1429,235],{"class":190},[150,1431,851],{"class":304},[150,1433,1434],{"class":190},"(ws._charts), ",[150,1436,1437],{"class":160},"\"charts\"",[150,1439,719],{"class":190},[10,1441,1442,1445,1446,1449,1450,1453,1454,1458],{},[147,1443,1444],{},"alpha=55000"," means 55% opaque. Theme accents keep the chart consistent with the workbook's colours; a plain hex fill such as ",[147,1447,1448],{},"\"4F81BD\""," works too but cannot carry transparency in openpyxl. Removing the outline with ",[147,1451,1452],{},"line.noFill"," avoids a hard edge around each translucent area. ",[14,1455,1457],{"href":1456},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fcreating-charts-in-excel-with-openpyxl\u002Fstyle-chart-colors-and-data-labels-with-openpyxl\u002F","Style Chart Colors and Data Labels with openpyxl"," covers series styling in general.",[20,1460,29,1465,29,1468,29,1471,29,1474,29,1480,29,1489,29,1494,29,1499,29,1504,29,1511,29,1515,29,1520,29,1524,29,1530,29,1535,29,1542,29,1547,29,1551,29,1555,29,1560,29,1563,29,1568,29,1571],{"viewBox":1461,"role":23,"ariaLabelledBy":1462,"xmlns":27,"style":28},"4 0 752 207",[1463,1464],"area-overlap-t","area-overlap-d",[31,1466,1467],{"id":1463},"Overlapping areas, opaque versus see-through",[35,1469,1470],{"id":1464},"Two panels. With opaque fills in a standard area chart, a larger area covers the others wherever they overlap, hiding them. With 55 percent opaque fills and no outlines, every series stays visible where they overlap, which works for two or three series.",[39,1472],{"x":41,"y":42,"width":43,"height":1473,"fill":45},"207",[39,1475],{"x":48,"y":49,"width":1476,"height":1477,"rx":447,"fill":1478,"stroke":1479,"style":1244},"351.0","175.0","#fee8f2","var(--accent,#f43f8f)",[1481,1482,1484],"g",{"transform":1483},"translate(182.5,29.0) scale(1.083)",[1234,1485],{"d":1486,"fill":1237,"stroke":1487,"style":1488},"M12 3.5l9.5 17h-19z M12 10v5 M12 17.8v.4","var(--accent-ink,#be185d)","stroke-width:1.66px;stroke-linecap:round;stroke-linejoin:round",[62,1490,1493],{"x":1491,"y":83,"style":1492},"195.5","font-size:14px;font-weight:700;fill:var(--accent-ink,#be185d);text-anchor:middle","Opaque fills",[152,1495],{"x1":1496,"y1":1497,"x2":1498,"y2":1497,"stroke":1479,"style":53},"36.0","91.0","355.0",[62,1500,1503],{"x":1501,"y":109,"style":1502},"60.0","font-size:12px;font-weight:400;fill:var(--text,#172033);text-anchor:start","larger areas cover the rest",[1481,1505,1507],{"transform":1506},"translate(38.5,99.5) scale(0.625)",[1234,1508],{"d":1509,"fill":1237,"stroke":1479,"style":1510},"M6 6l12 12 M18 6L6 18","stroke-width:2.88px;stroke-linecap:round;stroke-linejoin:round",[62,1512,1514],{"x":1501,"y":1513,"style":1502},"137.0","small series vanish",[1481,1516,1518],{"transform":1517},"translate(38.5,125.5) scale(0.625)",[1234,1519],{"d":1509,"fill":1237,"stroke":1479,"style":1510},[62,1521,1523],{"x":1501,"y":1522,"style":1502},"163.0","fine only when stacked",[1481,1525,1527],{"transform":1526},"translate(38.5,151.5) scale(0.625)",[1234,1528],{"d":1486,"fill":1237,"stroke":1529,"style":1510},"var(--gold,#b4740a)",[39,1531],{"x":1532,"y":49,"width":1476,"height":1477,"rx":447,"fill":1533,"stroke":1534,"style":1244},"389.0","#d9f4f1","var(--teal,#0f9488)",[1481,1536,1538],{"transform":1537},"translate(551.5,29.0) scale(1.083)",[1234,1539],{"d":1540,"fill":1237,"stroke":1541,"style":1488},"M5 12.5l4.5 4.5L19 7","var(--teal-ink,#0b6157)",[62,1543,1546],{"x":1544,"y":83,"style":1545},"564.5","font-size:14px;font-weight:700;fill:var(--teal-ink,#0b6157);text-anchor:middle","55% opaque fills",[152,1548],{"x1":1549,"y1":1497,"x2":1550,"y2":1497,"stroke":1534,"style":53},"405.0","724.0",[62,1552,1554],{"x":1553,"y":109,"style":1502},"429.0","overlaps stay visible",[1481,1556,1558],{"transform":1557},"translate(407.5,99.5) scale(0.625)",[1234,1559],{"d":1540,"fill":1237,"stroke":1534,"style":1510},[62,1561,1562],{"x":1553,"y":1513,"style":1502},"theme colours kept",[1481,1564,1566],{"transform":1565},"translate(407.5,125.5) scale(0.625)",[1234,1567],{"d":1540,"fill":1237,"stroke":1534,"style":1510},[62,1569,1570],{"x":1553,"y":1522,"style":1502},"best for 2–3 series",[1481,1572,1574],{"transform":1573},"translate(407.5,151.5) scale(0.625)",[1234,1575],{"d":1486,"fill":1237,"stroke":1529,"style":1510},[135,1577,1579],{"id":1578},"chart-data-from-a-pandas-pivot","Chart data from a pandas pivot",[10,1581,1582],{},"Transaction data is long — one row per sale — while a chart needs one column per series. Pivot it first, write the wide table, and point the chart at the columns the pivot created:",[140,1584,1586],{"className":177,"code":1585,"language":179,"meta":145,"style":145},"import pandas as pd\n\nsales = pd.DataFrame({\"Month\": months * 3, \"Region\": [\"North\"] * 12 + [\"South\"] * 12 + [\"East\"] * 12,\n                      \"Revenue\": north + south + east})\nwide = sales.pivot_table(index=\"Month\", columns=\"Region\", values=\"Revenue\", aggfunc=\"sum\", sort=False)[[\"North\", \"South\", \"East\"]]\nprint(wide.head(3))\n",[147,1587,1588,1601,1605,1671,1689,1761],{"__ignoreMap":145},[150,1589,1590,1592,1595,1598],{"class":152,"line":153},[150,1591,194],{"class":186},[150,1593,1594],{"class":190}," pandas ",[150,1596,1597],{"class":186},"as",[150,1599,1600],{"class":190}," pd\n",[150,1602,1603],{"class":152,"line":200},[150,1604,217],{"emptyLinePlaceholder":216},[150,1606,1607,1610,1612,1615,1617,1620,1623,1626,1628,1631,1634,1636,1638,1640,1643,1646,1648,1650,1652,1654,1656,1658,1660,1662,1664,1666,1668],{"class":152,"line":213},[150,1608,1609],{"class":190},"sales ",[150,1611,226],{"class":186},[150,1613,1614],{"class":190}," pd.DataFrame({",[150,1616,532],{"class":160},[150,1618,1619],{"class":190},": months ",[150,1621,1622],{"class":186},"*",[150,1624,1625],{"class":304}," 3",[150,1627,235],{"class":190},[150,1629,1630],{"class":160},"\"Region\"",[150,1632,1633],{"class":190},": [",[150,1635,537],{"class":160},[150,1637,1076],{"class":190},[150,1639,1622],{"class":186},[150,1641,1642],{"class":304}," 12",[150,1644,1645],{"class":186}," +",[150,1647,229],{"class":190},[150,1649,542],{"class":160},[150,1651,1076],{"class":190},[150,1653,1622],{"class":186},[150,1655,1642],{"class":304},[150,1657,1645],{"class":186},[150,1659,229],{"class":190},[150,1661,547],{"class":160},[150,1663,1076],{"class":190},[150,1665,1622],{"class":186},[150,1667,1642],{"class":304},[150,1669,1670],{"class":190},",\n",[150,1672,1673,1676,1679,1681,1684,1686],{"class":152,"line":220},[150,1674,1675],{"class":160},"                      \"Revenue\"",[150,1677,1678],{"class":190},": north ",[150,1680,931],{"class":186},[150,1682,1683],{"class":190}," south ",[150,1685,931],{"class":186},[150,1687,1688],{"class":190}," east})\n",[150,1690,1691,1694,1696,1699,1702,1704,1706,1708,1711,1713,1715,1717,1720,1722,1725,1727,1730,1732,1735,1737,1740,1742,1745,1748,1750,1752,1754,1756,1758],{"class":152,"line":294},[150,1692,1693],{"class":190},"wide ",[150,1695,226],{"class":186},[150,1697,1698],{"class":190}," sales.pivot_table(",[150,1700,1701],{"class":670},"index",[150,1703,226],{"class":186},[150,1705,532],{"class":160},[150,1707,235],{"class":190},[150,1709,1710],{"class":670},"columns",[150,1712,226],{"class":186},[150,1714,1630],{"class":160},[150,1716,235],{"class":190},[150,1718,1719],{"class":670},"values",[150,1721,226],{"class":186},[150,1723,1724],{"class":160},"\"Revenue\"",[150,1726,235],{"class":190},[150,1728,1729],{"class":670},"aggfunc",[150,1731,226],{"class":186},[150,1733,1734],{"class":160},"\"sum\"",[150,1736,235],{"class":190},[150,1738,1739],{"class":670},"sort",[150,1741,226],{"class":186},[150,1743,1744],{"class":304},"False",[150,1746,1747],{"class":190},")[[",[150,1749,537],{"class":160},[150,1751,235],{"class":190},[150,1753,542],{"class":160},[150,1755,235],{"class":190},[150,1757,547],{"class":160},[150,1759,1760],{"class":190},"]]\n",[150,1762,1763,1765,1768,1771],{"class":152,"line":365},[150,1764,845],{"class":304},[150,1766,1767],{"class":190},"(wide.head(",[150,1769,1770],{"class":304},"3",[150,1772,750],{"class":190},[10,1774,1775,1778,1779,1782,1783,1786,1787,1790],{},[147,1776,1777],{},"sort=False"," keeps the months in calendar order rather than alphabetical, which would put April first. Selecting the columns in a fixed order decides the stacking order — the first column is the bottom layer — so the steadiest series can be placed there deliberately. Write ",[147,1780,1781],{},"wide"," with ",[147,1784,1785],{},"to_excel",", then build the ",[147,1788,1789],{},"Reference"," from its position on the sheet as in Step 1.",[135,1792,1794],{"id":1793},"gaps-in-the-data","Gaps in the data",[10,1796,1797,1798,1801,1802,1805,1806,1808,1809,1813],{},"A month with no value leaves an empty cell. By default Excel drops an area chart to zero there, which draws a misleading valley. ",[147,1799,1800],{},"chart.display_blanks = \"span\""," joins the points either side instead, and ",[147,1803,1804],{},"\"gap\""," leaves a break; choose ",[147,1807,150],{}," when the value is missing rather than genuinely zero. If the blanks come from the data pipeline, fill them deliberately first — ",[14,1810,1812],{"href":1811},"\u002Fadvanced-data-transformation-and-cleaning\u002Fworking-with-dates-and-times-in-excel-data\u002Ffill-missing-dates-in-a-time-series-with-pandas\u002F","Fill Missing Dates in a Time Series with pandas"," covers the choice between zero and interpolation.",[135,1815,1817],{"id":1816},"common-pitfalls","Common pitfalls",[1819,1820,1821,1837,1845,1851,1857,1863],"ul",{},[1822,1823,1824,1828,1829,1832,1833,1836],"li",{},[1825,1826,1827],"strong",{},"No axes in Excel."," Set ",[147,1830,1831],{},"x_axis.delete = False"," and ",[147,1834,1835],{},"y_axis.delete = False",".",[1822,1838,1839,1828,1842,1844],{},[1825,1840,1841],{},"Stacked without overlap.",[147,1843,880],{}," for stacked groupings.",[1822,1846,1847,1850],{},[1825,1848,1849],{},"Too many layers."," Beyond five or six series, a stacked area becomes unreadable; group the small ones as \"Other\".",[1822,1852,1853,1856],{},[1825,1854,1855],{},"Volatile bottom layer."," Put the steadiest series first so upper layers are not distorted.",[1822,1858,1859,1862],{},[1825,1860,1861],{},"Stacking values that do not add up."," Stacking averages or rates produces a meaningless total; stack only additive measures.",[1822,1864,1865,1828,1868,1871],{},[1825,1866,1867],{},"Blank cells drawn as zero.",[147,1869,1870],{},"display_blanks"," or fill the gaps deliberately.",[135,1873,1875],{"id":1874},"performance-notes","Performance notes",[10,1877,1878],{},"A chart is a small XML part referencing cells, so it adds almost nothing to the file whatever the size of the data. Excel draws charts with thousands of points slowly; aggregate to the level the chart is read at — months rather than days — before charting.",[135,1880,1882],{"id":1881},"conclusion","Conclusion",[10,1884,1885,1886,1889,1890,1892,1893,1896,1897,1782,1900,1902,1903,1905,1906,1908,1909,1912,1913,1915],{},"Write one column per series with names in the header row, create an ",[147,1887,1888],{},"AreaChart",", and add the data with ",[147,1891,865],{}," and the categories with ",[147,1894,1895],{},"set_categories",". Use ",[147,1898,1899],{},"grouping = \"stacked\"",[147,1901,880],{}," to show a total and its parts, ",[147,1904,128],{}," with a ",[147,1907,1131],{}," axis to show the mix, and translucent scheme-colour fills for a standard chart with a few overlapping series. Always set both axes' ",[147,1910,1911],{},"delete"," to ",[147,1914,1744],{}," so Excel shows them.",[135,1917,1919],{"id":1918},"frequently-asked-questions","Frequently asked questions",[10,1921,1922,1925],{},[1825,1923,1924],{},"How do I create an area chart with openpyxl?","\nCreate an AreaChart, add the data with add_data(Reference(...), titles_from_data=True), set the categories with set_categories, and place it with ws.add_chart(chart, \"E2\"). Set chart.x_axis.delete and chart.y_axis.delete to False so Excel shows the axes.",[10,1927,1928,1931],{},[1825,1929,1930],{},"How do I make a stacked area chart in openpyxl?","\nSet chart.grouping = \"stacked\" and chart.overlap = 100. For a chart where every period adds up to 100%, use grouping = \"percentStacked\" with the same overlap.",[10,1933,1934,1937],{},[1825,1935,1936],{},"Why does my openpyxl chart have no axes in Excel?","\nopenpyxl 3.1 does not write the element that tells Excel an axis is visible, and Excel then hides it. Set chart.x_axis.delete = False and chart.y_axis.delete = False before saving. LibreOffice shows the axes either way, so check in Excel.",[10,1939,1940,1943],{},[1825,1941,1942],{},"How do I make overlapping areas transparent?","\nGive each series a solid fill made from a theme colour with an alpha value — a ColorChoice holding SchemeColor(val=\"accent1\", alpha=55000) — where 55000 means 55% opaque. openpyxl cannot attach transparency to a plain hex colour.",[135,1945,1947],{"id":1946},"related","Related",[1819,1949,1950,1956,1963,1970],{},[1822,1951,1952,1953,1955],{},"Up one level: ",[14,1954,17],{"href":16}," — every chart type.",[1822,1957,1958,1962],{},[14,1959,1961],{"href":1960},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fcreating-charts-in-excel-with-openpyxl\u002Fcreate-a-stacked-column-chart-with-openpyxl\u002F","Create a Stacked Column Chart with openpyxl"," — composition by period with bars.",[1822,1964,1965,1969],{},[14,1966,1968],{"href":1967},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fcreating-charts-in-excel-with-openpyxl\u002Fadd-line-chart-to-excel-report-with-python\u002F","Add a Line Chart to an Excel Report with Python"," — the unfilled version.",[1822,1971,1972,1976],{},[14,1973,1975],{"href":1974},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fcreating-charts-in-excel-with-openpyxl\u002Fformat-chart-axes-with-openpyxl\u002F","Format Chart Axes with openpyxl"," — scales, labels and hidden axes.",[1978,1979,1980],"style",{},"html pre.shiki code .sMTad, html code.shiki .sMTad{--shiki-default:#6F42C1;--shiki-dark:#FFB757}html pre.shiki code .srMev, html code.shiki .srMev{--shiki-default:#032F62;--shiki-dark:#ADDCFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .s-kum, html code.shiki .s-kum{--shiki-default:#D73A49;--shiki-dark:#FF9492}html pre.shiki code .skGVy, html code.shiki .skGVy{--shiki-default:#24292E;--shiki-dark:#F0F3F6}html pre.shiki code .sP0c6, html code.shiki .sP0c6{--shiki-default:#005CC5;--shiki-dark:#91CBFF}html pre.shiki code .s_Opv, html code.shiki .s_Opv{--shiki-default:#6F42C1;--shiki-dark:#DBB7FF}html pre.shiki code .sa561, html code.shiki .sa561{--shiki-default:#E36209;--shiki-dark:#FFB757}html pre.shiki code .sSjpA, html code.shiki .sSjpA{--shiki-default:#005CC5;--shiki-dark:#FF9492}",{"title":145,"searchDepth":200,"depth":200,"links":1982},[1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994],{"id":137,"depth":200,"text":138},{"id":170,"depth":200,"text":171},{"id":873,"depth":200,"text":874},{"id":991,"depth":200,"text":992},{"id":1280,"depth":200,"text":1281},{"id":1578,"depth":200,"text":1579},{"id":1793,"depth":200,"text":1794},{"id":1816,"depth":200,"text":1817},{"id":1874,"depth":200,"text":1875},{"id":1881,"depth":200,"text":1882},{"id":1918,"depth":200,"text":1919},{"id":1946,"depth":200,"text":1947},"2026-09-25","Show how a total builds up over time — revenue by region, hours by project, stock by warehouse — with a native Excel area chart. Build standard, stacked and 100% stacked area charts with openpyxl, make overlapping areas see-through, keep axes visible in Excel, order series so small ones are not hidden, and handle gaps in the data.","md",[1999,2001,2003,2005],{"q":1924,"a":2000},"Create an AreaChart, add the data with add_data(Reference(...), titles_from_data=True), set the categories with set_categories, and place it with ws.add_chart(chart, \"E2\"). Set chart.x_axis.delete and chart.y_axis.delete to False so Excel shows the axes.",{"q":1930,"a":2002},"Set chart.grouping = \"stacked\" and chart.overlap = 100. For a chart where every period adds up to 100%, use grouping = \"percentStacked\" with the same overlap.",{"q":1936,"a":2004},"openpyxl 3.1 does not write the element that tells Excel an axis is visible, and Excel then hides it. Set chart.x_axis.delete = False and chart.y_axis.delete = False before saving. LibreOffice shows the axes either way, so check in Excel.",{"q":1942,"a":2006},"Give each series a solid fill made from a theme colour with an alpha value — a ColorChoice holding SchemeColor(val=\"accent1\", alpha=55000) — where 55000 means 55% opaque. openpyxl cannot attach transparency to a plain hex colour.","create an area chart with openpyxl",null,{"breadcrumb":2010},[2011,2013,2016],{"name":2012,"item":1079},"Home",{"name":2014,"item":2015},"Formatting and Charting Excel Reports with Python","\u002Fformatting-and-charting-excel-reports-with-python\u002F",{"name":17,"item":16},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fcreating-charts-in-excel-with-openpyxl\u002Fcreate-an-area-chart-with-openpyxl",{"title":2019,"description":2020},"Excel Area Chart with Python openpyxl (Stacked and 100%)","Create area charts with openpyxl AreaChart: grouping standard, stacked and percentStacked, overlap=100, transparent fills with scheme colours and alpha, axis delete=False so axes show in Excel, series order, date categories and blank cells.","create-an-area-chart-with-openpyxl","formatting-and-charting-excel-reports-with-python\u002Fcreating-charts-in-excel-with-openpyxl\u002Fcreate-an-area-chart-with-openpyxl\u002Findex",[2024,2025],"charts-and-images","openpyxl","how-to","WF72rC8QfriJIVKp5Mdvl_GrJQsBIcu7eN5sZgra5-c",[2029,2033],{"title":2030,"path":2031,"stem":2032,"children":-1},"Create a Waffle or Progress Chart in Excel","\u002Fformatting-and-charting-excel-reports-with-python\u002Fcreating-charts-in-excel-with-openpyxl\u002Fcreate-a-waffle-or-progress-chart-in-excel","formatting-and-charting-excel-reports-with-python\u002Fcreating-charts-in-excel-with-openpyxl\u002Fcreate-a-waffle-or-progress-chart-in-excel\u002Findex",{"title":2034,"path":2035,"stem":2036,"children":-1},"Create a Bar Chart in Excel with openpyxl","\u002Fformatting-and-charting-excel-reports-with-python\u002Fcreating-charts-in-excel-with-openpyxl\u002Fcreate-bar-chart-in-excel-with-openpyxl","formatting-and-charting-excel-reports-with-python\u002Fcreating-charts-in-excel-with-openpyxl\u002Fcreate-bar-chart-in-excel-with-openpyxl\u002Findex",[2038,2040],{"path":2039,"title":17},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fcreating-charts-in-excel-with-openpyxl",{"path":2041,"title":2014},"\u002Fformatting-and-charting-excel-reports-with-python",[],[2044,2047,2050,2053,2056,2059],{"path":2045,"title":2046,"kind":2026},"\u002Fautomating-reporting-workflows\u002Fbuilding-multi-sheet-excel-dashboards\u002Fbuild-a-dashboard-sheet-with-charts-from-multiple-tabs","Build a Dashboard Sheet with Charts from Multiple Tabs",{"path":2048,"title":2049,"kind":2026},"\u002Fautomating-reporting-workflows\u002Fbuilding-multi-sheet-excel-dashboards\u002Fbuild-a-rolling-12-month-chart-on-an-excel-dashboard","Build a Rolling 12-Month Chart on an Excel Dashboard",{"path":2051,"title":2052,"kind":2026},"\u002Fautomating-reporting-workflows\u002Fgenerating-excel-reports-from-templates\u002Fkeep-charts-and-images-when-filling-an-excel-template","Keep Charts and Images When Filling an Excel Template",{"path":2054,"title":2055,"kind":2026},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fbuilding-excel-reports-with-xlsxwriter\u002Fadd-a-chart-to-an-excel-file-with-xlsxwriter","Add a Chart to an Excel File with xlsxwriter",{"path":2057,"title":2058,"kind":2026},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fbuilding-excel-reports-with-xlsxwriter\u002Fadd-sparklines-to-an-excel-report-with-xlsxwriter","Add Sparklines to an Excel Report with xlsxwriter",{"path":2060,"title":2061,"kind":2026},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fbuilding-excel-reports-with-xlsxwriter\u002Fbuild-a-waterfall-chart-in-excel-with-python","Build a Waterfall Chart in Excel with Python",1790972111237]