Skip to content
Moonsoft Software SolutionsDEMO
SITE

Homemoonsoft.es ↗

Demo SiteCalc Builder

21 of 21

Car and usage
Sets purchase price, consumption and maintenance.
Average driver: 12,000 to 20,000.
From 3 to 12.
Energy
The rest is charged in public points.

CalcBuilder example · Charts · Advanced

Electric vs Petrol Car Cost

December 1, 2026

Electric vs Petrol Car Cost shown on the live frontend, with a calculated result.

Live result on the frontend

Total cost of ownership: break-even line, stacked cost breakdown, CO2 chart and PDF report.

Video walkthrough

How the example is built, in under two minutes. English audio and subtitles.

What it calculates

A visitor picks a car size, the yearly distance, the years of ownership and the energy prices. The report shows:

  • Cheaper option and saving — total cost of ownership with the resale value deducted.
  • Break-even point — the year in which the cumulative spend of the electric car drops below the petrol one.
  • Three charts — cumulative spending lines, a stacked cost breakdown with its table and a CO2 comparison.
  • PDF report — the visitor can download the result as a PDF, charts included.

How it’s built

The form mixes radio buttons, option lists and number fields. The PHP Code holds a small catalogue of typical figures for each car size and fills the arrays used by the charts inside a loop, so the number of points follows the years chosen.

cumulative is a line chart with two series. breakdown is a bar chart with Stacked series and Also show the data table enabled. emissions is a simple bar chart.

The PDF button is enabled: the same charts are drawn in the PDF document, with no extra configuration.

Charts require the Calc Builder version that includes the Charts screen.

Electric vs Petrol Car Cost - charts on the frontend

The charts as your visitors see them.

Electric vs Petrol Car Cost - Charts screen

The Charts screen: type, data source, labels and data series of each chart.

Electric vs Petrol Car Cost - Exit Layout

The Exit Layout: each ##chart_name## tag marks where a chart is drawn.

Electric vs Petrol Car Cost - PHP Code screen

The PHP Code, which prepares the figures and the arrays used by the charts.

Electric vs Petrol Car Cost - input form on the frontend

The input form, styled with the Form Layout.

Want this exact example on your own site?

Download the file above, then in your Joomla admin open Components › CalcBuilder › Import and upload it — it’s the same file you’d get from that component’s own Export button, charts included.