Author Topic: Chart Markers - position the marker on the X axis  (Read 113 times)

Offline Sunchaser

  • Community Leader
  • *****
  • Join Date: Oct 2007
  • Posts: 224
  • Forum Citizenship: +5/-0
Chart Markers - position the marker on the X axis
« on: 17 Oct 2020 10:12:29 am »
Hi All,

Is it possible to position dynamically a marker on the X axis? I tried many many things, but I'm failing for the moment.
The vertical positioning (Y axis) is correct. When setting the marker, I used "Query Calculation" for the property "Numeric Position", and the result is correct.
I'm happy also as I can display dynamic values in the text / label of the marker.
BUT: how do I manage to dynamically set the position of this marker on the X axis ?
When setting the marker, I have the property "Category position", which can be set to Layout Calculation, Category Index, or Percent on Axis.
Category Index or Percent on Axis are not very interesting to me as it would be completely static, which is the contrary of what I would expect.
Now, Layout Calculation... I'm not able to get anything working here. Either I have an error, or it is not displayed, or it is displayed for each date of the time axis.
Do you have an example / a "real" practical example of how it could be set ?

Many thanks in advance  :)
V.

Offline Sunchaser

  • Community Leader
  • *****
  • Join Date: Oct 2007
  • Posts: 224
  • Forum Citizenship: +5/-0
Re: Chart Markers - position the marker on the X axis
« Reply #1 on: 19 Oct 2020 05:26:51 am »
Hi All,

It is finally working now.
When selecting "Layout Calculation", you have to enter a report expression which gives a boolean result. So, something like:
Code: [Select]
[myquery].[my_field_for_axis] = [myquery].[my_reference_for_marker]

The reason why it was not working for me at the beginning is the following:
. For the time axis / X axis, I'm using an data item which is not a date, but varchar. It is sending values like "Jan-20, Feb-20, Mar-20...etc.." Then, it is sorted with a data item which contains dates.
This is working fine for the graph itself.
But when I tried the report expression for the marker, I was comparing dates with dates: I was using the data item used for the sorting of the serie / the one with the dates and comparing it with another date.
But it was not working for the marker in the graph, as the data item used for the X axis is not a date... I was thinking that Cognos was able to work like this, but I was wrong (despite the fact that I had marked the fields in the "properties" of the marker)
Now that it is modified, my expression is based on the data item used for the time axis itself / the one sending varchar ("Jan-20..") and I do the comparison with a data item which has also values in varchar => it is working perfectly.

Cheers!
V.