Cognos popout label for selected item

2019-09-05 05:28发布

I have two similar javascripting challenges I am looking to solve in Cognos with the help of conditional formatting.

I would like to be able to show a data item, for only the item that I am comparing other items to in Cognos. For example, If my chart shows a comparison of Florida to the rest of the US States -- Florida is what I am doing am doing the comparison to within my charts.

So I would like to show the data label for Florida only. Conditional formatting in Cognos will let you either turn all item labels on, or off. I am looking to find a way to turn them all on with conditional formatting, but hide all the values, except the Florida value which is the focus of my report with javascript.

Here is an example of my chart and how it looks with all the data labels showing: http://i.imgur.com/aM4gEYu.jpg I only need to show the number for Florida. The rest of the numbers make the chart look way too cluttered.

Also - My second challenge is when my mouse hovers over the other labels - I would like to show the values for them (but only on hover). So basically the label will default to showing the Florida label only, but if the user hovers over the United States, or the World values - then the user will be able to see that item.

1条回答
我命由我不由天
2楼-- · 2019-09-05 06:06

Yeah conditional rendering unfortunately is not available everywhere, so it's not a viable solution.

Writing JS against a chart is tough, but I suppose not impossible. First, I'd highly recommend the FireBug plugin for Firefox. It will allow you to more easily see the generated HTML for a graph in Cognos. I just looked at a sample bar chart. Unfortunately, none of the elements have individual IDs. You will have to pull the "area" elements by attribute. The hover text for the bars and the label text are both in the TITLE attribute.

I have to put the obligatory "no JS" statement in here as I guarantee such a solution will break between versions of Cognos and potentially browsers.

An alternative may be to hide the standard chart labels and put Singletons below the chart to control the shown information.

If you still need help - can you take a screenshot of this chart? If not - can you elaborate on what type of chart it is and what other data values exist (other than FL, US, World). I think I may not be visualizing this properly.

查看更多
登录 后发表回答