ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Bar Charts Zero vs. NoValue
Posted by Laura on Sep-29-2015 02:42
Hi,

If I want to have a way of distinguishing between data point '0' and no value in simple xy
bar charts, what would be the best way of doing it?
For example, adding a bar whisker should show that there's data, and it's 0, on the axis,
how can I do that?

Thanks!

  Re: Bar Charts Zero vs. NoValue
Posted by Peter Kwan on Sep-30-2015 01:58
Hi Laura,

You can draw different things or different symbols or text labels or using other methods to
distinguish between 0 and NoValue. The best method depends on the structure of your
chart. For example, if your bar chart are simple bars (as opposed to startcked bars), and
are wide enough for text labels, you may put the text label "N/A" (for not available) or other
other text for NoValue. If your bar is very narrow (say each bar is only 3 pixels wide), you
may have to use some small symbols (such as small red dots) that are easily visible and add
some description in your chart so that people can know what these symbols mean.

Suppose you decide to use the text label "N/A" to denote no value. You can then ask
ChartDirector to put those labels at the desired point. For example, in PHP, it may be like:

for ($i = 0; $i < count($myData); ++$i)
    $labelPos[$i] = ($myData[i] == NoValue) ? 0 : NoValue;

$layer = $c->addLineLayer($labelPos, Transparent);
$layer->setDataLabelFormat("N/A");
$layer->setDataLabelStyle("arial.ttf", 8);

Hope this can help.

Regards
Peter Kwan

  Re: Bar Charts Zero vs. NoValue
Posted by Laura on Sep-30-2015 21:58
Attachments:
Hi Peter,

It's simple bar charts. But is there a way in php to show just a line for zero data point, as
shown?

Thanks!
bar chart.png

  Re: Bar Charts Zero vs. NoValue
Posted by Peter Kwan on Oct-01-2015 01:28
Attachments:
Hi Laura,

There are many methods to achieve something like "just a line". I have attached two
examples for reference.

The "simplebar2.php" draws bars with thick external border. The "zero" value is replaced
0.00000001. In this case, the bar will still be visible, and the thick external border makes it
look like a thick line. (Bars with thick external borders is a new feature in ChartDirector 6.)

The "simplebar3.php" uses a box-whisker layer to draw a thick "whisker" line at the zero
value position.

For your case, I noticed your example chart has a thick axis. In this case, the thick axis
may hide the thick line at y = 0. To solve the problem, you may move the y = 0 line a little
bit higher by using Axis.setMargin for the y-axis.

Hope this can help.

Regards
Peter Kwan
simplebar2.png
simplebar3.png
simplebar2.php
simplebar2.php

1.52 Kb
simplebar3.php
simplebar3.php

1.71 Kb