Why does Ignition Easy Chart throw / by zero on template open?

Mark Townsend11 min read
HMI / SCADAOther ManufacturerTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

You double-click a template instance, or right-click it and pick the open-template option, and the template does not open. The Designer console fills with the same exception, repeated over and over:

Exception in thread "AWT-EventQueue-0" java.lang.ArithmeticException: / by zero
  at ...easychart.ConstantPenDatasource.createTimeColumn(ConstantPenDatasource.java:124)
  at ...easychart.ConstantPenDatasource.updateData(ConstantPenDatasource.java:108)
  at ...easychart.ConstantPenDatasource.startup(ConstantPenDatasource.java:80)
  at ...PMIEasyChart$EasyChart.startup(PMIEasyChart.java:2220)

Interleaved with it you may see tag subscription lines such as Changing connected quality to 'Good', Subscription crc mismatch, will resubscribe. and Changing connected quality to 'Bad_GatewayCommOff'. Those are noise.

The template file is not corrupt. An Easy Chart inside it holds a saved configuration that makes its constant-pen code divide by zero. The Designer starts every component when it opens a template, so the chart throws on every open, and the open is aborted.

Skip These Fixes First

Each of these gets tried for this symptom. None of them touches the saved chart configuration, so none of them works.

  • Turning Gateway comms off. ConstantPenDatasource builds its data locally from the chart's own properties. The trace shows no tag read, query, or history call between WindowWorkspace.openTemplate and the division. Comms mode only governs tag subscriptions. The log proves it: tag quality flips from Good to Bad_GatewayCommOff and the exceptions keep coming.
  • Exporting the template and importing it into a separate project. The export carries the serialized component properties, including whatever produces the zero. New project, same startup, same exception. The test does tell you one thing: the fault lives in the template resource itself, not in project scripts, client settings, or the source project's tag provider.
  • Restarting the Designer or clearing the local cache. The bad value is saved in the project resource on the Gateway. A fresh Designer session pulls down the same resource and hits the same line.
  • Opening it from a different entry point. The right-click path (TemplateHolderBeanInfo$PopupInitializer) and the double-click path (TemplateHolderBeanInfo$OpenTemplateForDesign.onDoubleClick) both land in WindowWorkspace.openTemplate and then VisionTemplate.startup. Opening from the project browser runs the same template startup.
  • Hunting for a design-only, no-execute open mode. Vision design mode still starts components; that is how bindings and charts render inside the editor. There is no switch that opens a template as inert data in the workspace. The XML route below is the only way to edit it without executing it.

Read the Two Call Paths in the Trace

Start here. The trace alternates between two paths that both end at createTimeColumn line 124.

Path A: template startup.

WindowWorkspace.openTemplate (2236 -> 2178 -> 2208)
  VisionTemplate.startup (182)
    ComponentVisitor.walk / StartupVisitor.visit
      PMIEasyChart.startupComponent (3269)
        EasyChart.setQueriesEnabled (2953)
          EasyChart.startup (2220)
            ConstantPenDatasource.startup (80) -> updateData (108) -> createTimeColumn (124)

This is the open itself. The Designer walks every component in the template and calls its startup. When the Easy Chart throws, the exception propagates out of openTemplate on the event dispatch thread, and the template never finishes opening.

Path B: the chart updater.

EDTUtil$ProcessQueue.run (126)
  PMIEasyChart$ChartUpdater.run (703)
    PMILineChartPanel.createChart (135)
      EasyChart.createChartImpl (2763)
        EasyChart.startup (2220)
          ConstantPenDatasource ... createTimeColumn (124)

This is a queued chart rebuild. The chart schedules redraws on the Swing event queue, and each one re-runs startup and throws again. That is why the console floods instead of logging one error.

Line numbers belong to the build you are running and shift between versions. The method names do not. If your trace ends in ConstantPenDatasource.createTimeColumn, this article applies.

Understand Why the Division Hits Zero

Java throws ArithmeticException: / by zero only for integer division (int or long). Floating-point division by zero returns Infinity or NaN and does not throw. So the divisor at line 124 is an integral value: a count or a millisecond span.

createTimeColumn builds the timestamp column for the chart's constant pens. A constant pen is a fixed-value line, and to plot it the chart generates timestamps across its time axis. The divisor comes from chart settings. Inspect these, in this order:

  1. The chart's time range. If start and end resolve to the same instant, any span-based step is zero. The usual culprit is dates bound to template parameters whose default values are null, equal, or unset when the template runs standalone in the Designer.
  2. Resolution or point-count settings. A value that evaluates to zero, or to a count that makes the step calculation zero, produces the same exception.
  3. Component size. If a point count derives from the plot width, a chart squeezed to zero width, or sized by a binding that evaluates to zero in the Designer, feeds a zero into the calculation.
  4. The constant pens dataset itself. Rows added during the last edit are the change that activated this code path.

Next, decide whether the zero comes from parameters or from static properties. Open a client window that uses this template with real parameter values and watch the client console. If the client runs clean, the template's default parameter values collapse the range. If the client throws the same trace, a static chart property is at fault.

Match the Symptom to the Cause

Symptom Cause Action
Exception on every open, both call paths, also after import into a new project Saved Easy Chart configuration in the template resource Restore a backup, or edit via Copy XML / Paste XML
Template editor fails, client windows using the template run clean Template parameter defaults drive the chart range or point count to zero Fix the parameter defaults in the XML, or delete the chart and rebuild with safe defaults
Client windows throw the same ConstantPenDatasource trace Static chart property produces the zero regardless of parameters Fix or remove the chart; this also affects runtime, so treat it as a production fault
Exceptions continue with comms off Local calculation; the Gateway is not involved Stop troubleshooting the connection
Subscription crc mismatch, will resubscribe. warning Normal tag resubscribe after a comms state change None; unrelated to the chart
Paste XML fails or the template comes back broken after an edit Malformed XML: unbalanced element or damaged value Revert to the untouched copy and redo the edit

Pick the Recovery Path

Three paths get the template back. Choose by what you have, not by what feels thorough.

  1. A backup from before the change exists. Restore it. This is the fastest fix, and the right one when the broken edit was small.
  2. No backup, and most of the template's value is outside the chart. Use Copy XML / Paste XML to delete the Easy Chart component, paste the template back, and rebuild only the chart.
  3. No backup, and the XML is large. A template of a few thousand XML lines is slow to hunt through, and the serialization format is cryptic. If you cannot find the chart element quickly, rebuild the template from your last known starting point.

Time-box the XML hunt. Finding the exact bad property wastes time when deleting the whole chart gets you a working template in one pass.

Restore the Pre-Change Template

  1. Export the broken template first and keep the file. You want it if the same fault comes back, or if you escalate to support.
  2. Locate the last good copy: a template export, a project export, or a Gateway backup taken before the chart edit.
  3. Import the good copy. Resolve the name conflict deliberately, either by overwriting the broken resource or by importing under a new name and repointing instances.
  4. Open the restored template and confirm the console stays clean.
  5. Reapply the lost changes one at a time. After each chart property change, save, close the template, and reopen it. The change that brings back / by zero is your root cause. Write it down.

Edit the Template Through Copy XML / Paste XML

This lets you change the template without the Designer starting its components.

  1. In the Designer project browser, Shift-Right-Click the template and select Copy XML.
  2. Paste into a text editor that supports XML highlighting and element folding. Save an untouched copy as your fallback before you change anything.
  3. Find the Easy Chart component (next section) and either delete it or fix the offending value.
  4. Run the editor's XML well-formedness check. One missed closing tag breaks the paste.
  5. Select all, copy to the clipboard, then Shift-Right-Click the template in the Designer and select Paste XML.
  6. Open the template. If it opens, save the project immediately.
  7. If it still throws, compare your edit against the untouched copy. You either missed a second Easy Chart or changed the wrong element.

Find the Easy Chart in the XML

  • Search for the class name from the trace: PMIEasyChart. The component entry references its implementing class, so this lands you on the chart's opening element. Check for more than one hit. Every Easy Chart in the template is a candidate.
  • Fold the element so you see its start and end. Everything between them is the chart's configuration: pens, constant pens, dates, and bindings.
  • Fastest safe edit: delete the entire chart element, from its opening tag to its matching close. The rest of the template survives, and you rebuild one component instead of the whole template.
  • Less invasive edit: clear the constant pens rows inside the chart. With no constant pens, the chart may start cleanly. If the exception persists after the paste, delete the component instead.
  • Parameter-driven zero: if the chart's dates or sizing are bound to template parameters, find those parameters' default values at the template root and give them values that produce a real, non-zero range.

Do not hand-edit serialized dataset or date encodings you do not recognize. Deleting a whole element is safer than rewriting a value in a format you cannot read.

Rebuild the Chart Without Reintroducing the Zero

  • Add the Easy Chart back and configure it in groups: data pens first, then time range, then constant pens last. Save, close, and reopen the template after each group.
  • Give every template parameter that feeds a chart date a default that yields a real span. Start must be earlier than end, and neither may be null when the template runs standalone.
  • Guard date expressions against null parameters so the Designer's standalone run falls back to a sane range.
  • Do not bind chart width, height, or resolution to parameters that default to zero.
  • Export the template before your next chart edit. The quickest fix for this fault is always the restore, and that only exists if you made the export.

Verify the Template Opens Clean

  1. Clear the Designer console so old traces do not confuse you.
  2. Open the template from the project browser. Confirm no ArithmeticException appears.
  3. Open it again by double-clicking an instance, and again through the right-click menu. Both call paths must stay clean.
  4. Toggle preview mode and switch Gateway comms on so the chart runs with live tags. Watch for the ChartUpdater path, which fires on redraws after the open succeeds.
  5. Open a client window that uses the template with production parameter values. Check the client console for any ConstantPenDatasource frame.
  6. Save, close the Designer, relaunch, and open the template once more. This confirms the saved resource on the Gateway is clean, not just your session.
  7. Export the working template as your new known-good copy.

Package the Failure for Support

Collect this before you file a report, while the broken state is still reproducible:

  • The exact Ignition version from the Designer's About dialog. The line numbers in the trace are build-specific.
  • The complete trace from the first exception, including both call paths.
  • The untouched Copy XML output of the broken template.
  • The result of one isolation test: a new, empty template holding a single Easy Chart with one constant pen and the same time-range settings. If that reproduces the exception, the fault is in the product, not your template.

FAQ

Why does my Ignition Vision template throw ArithmeticException / by zero when I open it?

An Easy Chart inside the template has a saved configuration that makes ConstantPenDatasource.createTimeColumn perform integer division by zero during component startup. The Designer starts every component when it opens a template, so the exception aborts the open every time.

Why does turning off Gateway comms not stop the Easy Chart exception?

The constant-pen time column is computed locally from chart properties, with no tag or query involved. Comms mode only changes tag subscription quality, which is why the log shows Bad_GatewayCommOff while the exceptions continue.

Why does importing the template into another project give the same error?

The export carries the serialized chart properties, including the value that produces the zero divisor. Any project that opens the template runs the same startup and throws on the same line.

How do I edit a Vision template without the Designer executing it?

Shift-Right-Click the template in the project browser, select Copy XML, edit the text in an external editor, then Shift-Right-Click the template and select Paste XML. Deleting the whole PMIEasyChart element is faster and safer than hunting for the single bad property.

When should I stop editing XML and contact Inductive Automation support?

Stop when a new template with a single, freshly configured Easy Chart and valid time range reproduces the ConstantPenDatasource exception, or when a clean Paste XML still fails to open. Escalate through Inductive Automation's official support channel with the Ignition version, the full trace, and the broken template XML.

Back to blog