38
Views
8
Comments
Line chart displaying null or zero values
Question

Hi everyone,

I would like to ask if it's possible to prevent a line from being displayed in a line chart when the value is zero or null, even if it causes the line to be interrupted.

For example, in the screenshot below, I would like the months of January and February, which have a value of 0, not to be represented by the line on the graph.


2023-04-16 15-25-31
Krishnanand Pathak

Hi Sabrina,

Filter out not null values and then reassign the datapoint list with filtered not null values that way you can avoid showing null value on chart. We are just removing null values from the Datapoints list.

I have attached the oml for your reference.

Thanks
Krishnanand Pathak

LineChart.oml
2023-06-15 08-46-02
Yonas Asmelash Nuguse

Hello Krishnanand, by filtering the list where the value is 0 we would eliminate the lebals as well. Do you happen to know a way to draw the chart legend only where there's a value that's different from zero? 

UserImage.jpg
Sabrina Fiore

I agree with Yonas. Also, @Krishnanand Pathak, I tried to replicate your solution by applying the FilterList and filtering the value by 0, but it doesn't work in our case. Do you know if we need to set any specific parameters in the chart properties to exclude values equal to '0' or NullIdentifier() from the chart? 

Thanks in advance


2021-09-06 15-09-53
Dorine Boudry
 
MVP

@Sabrina Fiore ,

all datapoints are part of the chart, if you don't wan't datapoint with value 0 at let's say label february 2024, then don't add that datapoint into your list. (as said before with filtering, or even better, it not coming out of your data retrieval)

That being said, it is not clear what you want to show instead, can you show an example drawing of how you want your chart to look, does the label still have to be there ? is there a line connecting the value before that label to the value after that label, etc.  

If you don't want a line connecting the dots, I doubt a line chart is the way to go.

UserImage.jpg
Sabrina Fiore

Morning @Dorine Boudry,

Thank you very much for your reply. I have already tried not displaying the value when it is equal to 0 or NullIdentifier(), as shown in the first screenshot attached.

Actually, in the 'ListAppend2' inside the property 'value', I wrote the condition:GetImpreses_CurrentYear2.List.Current.Imprese.Infortuni <> 0 or GetImpreses_CurrentYear2.List.Current.Imprese.Infortuni <> NullIdentifier() to print the value only when it is different from 0 or NullIdentifier().

However, OutSystems completely ignores my command. We also tried adding a filter inside the aggregate to exclude data where the value is 0 or Null, but it didn't work.

Answering your second point, I have shared a sketch in the second screenshot showing what we expect from the graph. We would like to avoid displaying the line and dots when their values are equal to zero or null, even if it means interrupting the line, for example, as could happen between May and June (even though this is not shown in the screenshot).




2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Sabrina,

It seems you're not the only one with this question. One of those links lead to this solution, but I'm not sure how to implement this in OutSystems with the latest version of the charts component. @Dorine Boudry do you know if this is possible?

2021-09-06 15-09-53
Dorine Boudry
 
MVP

I'll have a try. Not all options that are possible on Highcharts are possible on the OutSystems component, and it is not documented which are and are not (last time I looked)

2021-09-06 15-09-53
Dorine Boudry
 
MVP

the proposed method I can find is to turn a 0 value into a null.  The problem with OutSystems is that it does not have the concept of null in its variables. 

So you'd have to write javascript to manipulate the retrieved data before passing it into the chart.  I don't know enough about the OutSystems client code or the Highcharts code or even react to help with that.  

Alternative is to just make your own Highcharts component (so bypassing OutSystems Charts entirely) and pass in the data in the form of a JSON.  (what you used to be able to do with older versions of OutSystems Charts)

@Gonçalo Martins or @Benjith Sam Do you know of a way for Charts v3 to make a datapoint value null and make sure the chart is redrawn with that value ?  I'm thinking something along the lines of using OutSystems.ChartAPI to manipulate the datapoints and trigger a redraw, but I really don't know how to do that.  

I can find somewhere deep inside the list of values, and manipulate them, but don't know if this is the right place and don't know how to cause a redraw.

Dorine

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.