↓ Skip to main content
A watercolour of nine round doorbell buttons in a row on a pale wall. Seven are teal. Two are orange and have a crack.

Two Chart Types That Did Not Answer a Click

A chart becomes useful on a phone when it answers a tap: the user touches the bar for “in progress”, and the list below shows these work orders. The framework has an attribute for that, and it is the same on every chart type. We tried it on all nine. On two of them it does nothing, and nothing tells you so.

MAS 9.2 series charts

We measured this on our test system, on the MAS 9.2 series, in the browser preview of our Components Explorer at the width of a phone. Each tap was a real pointer event on a point that the browser itself assigned to the mark.

The attribute
#

A chart names a method of the controller in on-segment-click, and it can pass a value with on-segment-click-arg:

<chart id="fs_d_charts_bar" type="bar" datasource="fs_d_charts_ds_status" height="240px"
    on-segment-click="chartClick"
    on-segment-click-arg="{{'chart': 'bar', 'event': event}}">

These are the first lines of the element on our page. The page has nine charts, one of each type, and every chart names the same method. The method writes the type into a state, and a label shows which types have answered:

chartClick(arg) {
  const type = (arg && arg.chart) || 'unknown';
  const seen = this.seen || (this.seen = []);
  if (!seen.includes(type)) seen.push(type);
  this.page.state.clicks = seen.join(', ');
}

The block is shortened by one line that shows what the event carries.

The test
#

We tapped one mark in each chart, one chart after the other: a bar, a point of a line, a slice, a circle.

TypeWhat we tappedDid the handler run?
bara baryes
linea point of the lineyes
stacked-bara part of a baryes
grouped-bara baryes
donuta segment of the ringyes
piea sliceyes
circle-packa small circleyes
areaa point of the line above the areano
scattera point, and then another oneno
The top of the lab page after a tap on every chart. A line reads: Types that answered a click: bar, line, stacked-bar, grouped-bar, donut, pie, circle-pack.
After one tap on each of the nine charts, seven types are in the list

Seven types are in the list. area and scatter are missing.

What silence looks like
#

Two charts side by side: an area chart over six months, and a scatter chart with six points in two colours.
area and scatter: the two types whose taps reached no handler

Nothing marks these two as different. The build accepts the attribute on them, in the browser build and in the strict mobile build. Both charts draw as they should. A tap on a point of the scatter chart even showed the tooltip of that point. Our handler did not run, the console got no new line, and no message appeared.

For a developer this is the costly kind of fault. The code is right, the markup is right, and the feature does not work. The first place to search is the own controller, and we found nothing wrong there.

What we can say about the reason
#

From the outside we can say three things about our page.

  • Round points are not the reason. A line chart draws round points, and so does a scatter chart. On the line chart a tap on a point runs the handler.
A line chart over six months with a round point for each month.
The line chart: a tap on one of its six points ran the handler
  • The data is not the reason. The line chart and the area chart on our page read the same datasource.
  • The method is not the reason. It is the same method for all nine charts.

What is left is the chart type itself. We could not find a cause in our own markup or in our controller.

What to do
#

You wantUse
a tap on a trend over timeline. It looks like the area chart without the fill, and its points answer.
a tap on parts of a wholedonut or pie
a tap on categoriesbar, stacked-bar or grouped-bar
an area chart or a scatter chart with a tapa button or a list beside the chart, for the choice that the tap would have made

And one habit: test the tap on every chart type you use, on the release you ship on. Our result belongs to one release, so test again after an update.

Check it yourself
#

  1. Put on-segment-click="chartClick" on an area chart and on a bar chart of the same page.
  2. Let chartClick write a line to the console.
  3. Tap a bar, and then a point of the area chart.
  4. Count the lines in the console.

What to read next#

Every Chart Type in the Maximo Application Framework shows all nine types. Event Handling Patterns says what a handler receives, and Error Handling Basics lists the other faults that reach nobody.


IBM documents the attributes on-segment-click and on-segment-click-arg of <chart> in the product itself, in the Application Configuration application under Component Documentation.