Chipotle Mexican Grill's (NYSE:CMG) stock almost doubled in 2019, landing the fast-casual burrito maker at No. 3 in the top five best restaurant stocks of the decade.

But this performance has not been without a lot of drama -- the last four years have been a gut-wrenching ride for shareholders. Bad news started in September 2015, with a store closing because customers got sick from norovirus. But things went from bad to worse with an E. coli incident in November 2015, and additional episodes of customers getting sick extending into 2016. The stock tanked, and has only recently recovered, climbing to all-time highs.

Let's take a look at seven charts that show how these events impacted the business and give a picture of where the company is today.

1. A decade of market-beating returns

CMG Chart

CMG data by YCharts.

The first half of the 2010s was an incredible rocket-ship ride for shareholders: The stock blasted up almost 600% from January 2010 to June 2015. But when customers started getting sick, the stock plunged. Between management's slow response to the crisis, plentiful press coverage of the events, and social media backlash, shares were affected for an extended period. Investors saw the first glimpse of hope when the board of directors announced Brian Niccol as the new CEO in February 2018.

Three tacos on a plate, surrounded by tomatoes and chile peppers

Image source: Getty Images.

Let's look at how top-line revenue has performed during this tumultuous period.

2. Four years of revenue

Bar chart of quarterly revenue. It starts in Q3 2015 at $1.22 billion, drops to $0.83 billion in Q1 2016, then rises gradually to $1.40 billion in Q3 2019.

Quarterly revenue in billions. Data source: Company earnings reports. Chart by author.

Revenue in late 2015 and early 2016 was impacted by customers who stopped showing up to eat. The impact was swift and dramatic, with Q1 2016 dropping 32% from Q3 2015 (which was before the events). From 2016 on, revenue has been on a slow upward trajectory.

But that event had a lasting impact on the top line, as the most recent quarter's number is only 15% higher than it was four years ago. This is not the spicy performance investors had been enjoying in the previous four years (2011 to 2015), when annual revenue doubled. This extra-mild growth is especially disappointing since Chipotle has many more stores today.

3. Adding stores throughout the crisis

Combination bar and line graph. Bars show the number of stores, starting at 1931 in Q3 2015 and rising to 2546 in Q3 2019. The line graph shows year-over-year store growth over the same period; it starts at 12% in Q3 2015, rises to 13.1% in Q2 2016, then decreases to 2.3% in Q2 2019 and bumps up in the most recent quarter to 3.4%.

YOY = year over year. Data source: Company earnings reports. Chart by author.

Despite the food-safety problems, the company never stopped adding stores. But it did slow store growth to focus on new safe-cooking procedures and reestablish operational discipline. By 2018 there were fewer than 100 stores opened, marking the lowest number of adds in the previous 10 years.

The most recent quarter is the first time in three and a half years when store additions accelerated as a percentage of the total. This may be because management is gaining confidence in individual store performance.

4. Same-store sales are improving

Bar chart showing comparable same-store sales. They start at Q3 2015 at 2.6%, then drop into negative territory for five quarters, bump up in Q1 and Q2 2017 against some easy comps, then start a slow and steady ascent from 1% in Q3 2017 to 11% in Q3 2019.

Data source: Company earnings reports. Chart by author.

The company defines comparable same-store sales as "the change in period-over-period sales or paid transactions for restaurants in operation for at least 13 full calendar months." This is a good measure to understand whether individual store traffic is improving. At first glance, the fact that the last nine quarters in a row have seen better comps would seem exciting, especially since the last two quarters were in the double-digit range. But the declines from the end of 2015 through 2016 have made this an easy hurdle to jump. A better metric to judge the state of the recovery is average restaurant sales.

5. Average restaurant sales is a key metric

Bar chart of average restaurant sales. They start in Q3 2015 at $2.53 million, drop for the next five quarters to $1.87 million in Q4 2016, then slowly rise to $2.15 million in Q3 2019.

Note: Quarterly average restaurant sales in millions. Data source: Company earnings reports. Chart by author.

Average restaurant sales peaked at $2.53 million in Q3 2015, and haven't returned to that number since. Management defines this metric as "the average trailing 12-month sales for restaurants in operation for at least 12 full calendar months." Because it's a 12-month look back rather than just a three-month view, this metric is slower to change quarter to quarter. For investors and Chipotle management, this is a key measure of the health of the brand. The last six quarters have seen sequential improvements, indicating not only that traffic is stabilized but also that the actions management has taken are making an impact.

Investors should be excited about the marked improvement, but should also note that the average store has 15% less revenue than it did four years ago. Management is focused on improving store traffic with technology.

6. Digital ordering is a growth engine

Bar chart of digital sales as percentage of revenue. They start at 6.0% in Q3 2016 and rise to 18.3% in Q3 2019

Data not reported for Q4 2016 and Q1 2017. Data source: Company earnings reports. Chart by author.

Mobile ordering has been available for burrito lovers since 2009, but it only became a priority for management in late 2016. A change in the mobile ordering process to allow faster pickup times in February 2017 showed that Chipotle was serious about making it easy for customers to order online.

The company has continued to drive improvements in digital, and rolled out its long-awaited reward program nationally in March 2019. Management believes it has only started to tap into what's possible with its digital efforts. This initiative is important for investors to watch for two reasons: It's improving store traffic, and digital orders are more profitable.

7. Store-level margins improving

Stacked bar chart of store-level operating costs as percentage of revenue. Q3 2015 shows 33% for food costs, 22% for labor costs, 6% for occupancy costs, and 11% for other, totaling 72%. Costs increased to 86% in Q3 2016, then gradually declined to 79% in Q3 2019.

Data source: Company earnings reports. Chart by author.

Not only was Q3 2015 a high watermark for average store sales, but it was also a record for store-level operating margins. Store-level margins are the percentage of average store revenue left after subtracting costs for running the restaurant (including occupancy, labor, and food). This number hit a high of 28% in Q3 2015, with costs coming in at a low 72%. Margins suffered through 2016, with reduced traffic and additional costs for food-safety initiatives. Costs have been slowly getting back in line, but are still 7 percentage points above where they were four years ago.

CFO Jack Hartung said on the last conference call that if the company was able to get store sales back to $2.5 million, it could see store-level margins hit 25%. This would be another 4-percentage-point improvement from today, and close to the historical high.

The bottom line for investors

Chipotle's results are slowly trending in the right direction, but the stock has risen to a nosebleed price-to-earnings ratio of 78. This lofty P/E means that investors have high expectations for results, and any quarter when they don't measure up, the stock could get punished.

Given where the company is starting 2020, it's doubtful that investors will see Chipotle reappear in the top five list of best restaurant stocks during the coming decade.