Pentaho

 View Only

 CCC Line Chart pointLabel_text values

  • Pentaho
  • Ctools
  • Pentaho
Lee Thurston's profile image
Lee Thurston posted 05-08-2018 18:50

I'm using Pentaho 5.4.0.6.154

I'm building a CCCLineChart (attached LineChart png) that uses the series as the line path, the category as the x-point, and the value as the y-point.

The y-axis and the y-point is being generated for me by Pentaho's protovis chart rendering magic. So far so good.

How can I change the x/y node's text value so it displays value2 rather than value?

As you can see in the attached (scene.datum.atoms png) image, the value of value2 is available, however there is no straightforward manner to assign that value to the pointLabel_text Extension Point.

I currently am trying to use the Pre Execution of the Chart (see code bock in attached ModifyLineChartExtensionPointLabelValues.txt).


#Pentaho
#Ctools
Lee Thurston's profile image
Lee Thurston

I had been working on this for quite a few hours, and as I was putting together this question, I actually thought I had resolved this just now.

The question posed is close to working, however the values display as 0 sometimes. So I am not sure I am using the proper approach.

If anyone could help out, by pointing me to a resource that explains "how to", I would greatly appreciate it.

Lee

Duarte Cunha Leao's profile image
Duarte Cunha Leao

Hi Lee,

try this:

eps.pointLabel_text = function() {   return this.scene.datum.atoms.value2.label; };

or, similarly, use the valuesMask option:

cccOptions.valuesMask = "{#value2}";

Cheers!

Lee Thurston's profile image
Lee Thurston

Thanks Duarte. These solutions do place the value2 in the text of the node. I like the brevity of the valuesMask.

However, there is still an issue where the labels display as zero for one of the lines.

This line chart is called from a clickAction on a bar chart which sets the "incident type" parameter for the line chart query then initiates a fireChange event. But one of the 'incident type" lines loads differently (as a sum?) .

One of the five categories of counts displays zeroes.

As shown in the image, the tooltip shows the count of 1 incident, however the node display 0.

Does the "sum" result not have the count in the ${#value2} element?

oneinhoverzeroonnode

The other four categories of counts, the numbers display properly.

pastedimage_1

Any ideas how to code the chart to recognize when the result is a "sum", then use the different element?

Thanks again,

Lee

Duarte Cunha Leao's profile image
Duarte Cunha Leao

Hi Lee,

the sum symbol in the tooltip reveals that there are two rows in the dataset which have the same value of series and category. CCC handles this by summing the measures and displaying a single dot for both.

You could revise the query which returns this data set to return unique rows per combination of series and category value.

Otherwise, if you would simply like to emphasize the existence of two data points, you could display dots with a different shape, when the scene that they represent contains more than one row:

function() {   this.chartDefinition.dot_shape = function(scene) {     return scene.datums().count() <= 1 ? "circle" : "diamond";   }; }

Cheers!

Data Conversion's profile image
Data Conversion
Data Conversion's profile image
Data Conversion
Data Conversion's profile image
Data Conversion
Data Conversion's profile image
Data Conversion
Data Conversion's profile image
Data Conversion
Attachment  View in library
Data Conversion's profile image
Data Conversion
Data Conversion's profile image
Data Conversion