Cognite Charts - flag the far-off datapoints

  • 30 August 2023
  • 9 replies

Badge +2

I have a CDF chart that is showing some output based on the timeseries associated with. I want to flag the points on the chart that are beyond some threshold. (say anything >0.5 and <-0.5 is abnormal and need to be flagged off in the chart) IS there a way to show that in the CDF charts visualization.


Best answer by Knut Vidvei 30 August 2023, 12:53

View original

9 replies

Userlevel 3


This is a great question. You have two options based on if you need to evaluate historic thresholds, or be alerted on future thresholds.

  1. Future thresholds. In the right hand menu, choose Monitoring and create a monitoring-job to evaluate the threshold for future incoming data. You will receive an email when it is breached, and alerts are available in Charts under menu “Alerts”
  2. Historic threshold breaches. Use the right hand menu “Thresholds”, and select Over or Under or Between. The breaches and the total duration is shown. It is however not “flagged” or highlighted in the Chart beyond showing the threshold line as if now.


Badge +2

Thanks @Knut Vidvei. Is there a way to use Outlier detection and visualise that in the same timeseries?

I am not able to understand and use that in CDF charts. 


Actually, It must look like the box plots and must show all the normal points and the outliers in a different color.

Userlevel 3


The outlier detection gives you a new time series that based on your settings calculates whether the data points in the source time series are outliers or not.

The new time series will be 0 if no outliers are found and 1 if there are outliers that match your input settings.


If you want to go deeper, and see Python code and examples using the underlying Industrial Data Science Library you can also see details here:


Badge +2

Hi @Knut Vidvei 

I would want to show that in the same chart itself. That is what my customer is asking for. If I have to work outside charts, I can use core Python and other visualization tools to show that details. 

For ex: this code will show it pretty well using core Python. 

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

# Generate example time series data
n_points = 100
timestamps = pd.date_range(start='2023-01-01', periods=n_points, freq='D')
values = np.random.normal(loc=50, scale=10, size=n_points)
values[20] = 150 # Adding an outlier

data = pd.DataFrame({'Timestamp': timestamps, 'Value': values})

data['Z-Score'] = (data['Value'] - data['Value'].mean()) / data['Value'].std()

outlier_threshold = 2

outliers = data[data['Z-Score'].abs() > outlier_threshold]

# Plotting
plt.figure(figsize=(10, 6))
plt.plot(data['Timestamp'], data['Value'], label='Time Series')
plt.scatter(outliers['Timestamp'], outliers['Value'], color='red', label='Outliers')
plt.title('Time Series with Outliers')

The output will look like this for the above standard-python code snippet.

Outlier Sample chart visual using standard python


Userlevel 3

Using Python code and InDSL you will have the full freedom to customize your views. These preferences will vary from user to user, and customer to customer.

However, you can still do a lot in the fronted. if you use the visualization setting in the outlier detection time series, and set Type to “none”, it will show the dots as you have in your Python plot above. I scaled here the y-axis so that the results with 0 is below the view line.

Allowing full flexibility as you have in Python in a no-code frontend is a bigger challenge, as it would lead to an unmanageable number of settings and buttons. 

Badge +2

Please could you share a clear example with steps; I dont see any type or such setting in CDF charts in front-end.


@eashwar11 You should just be able to click on the corresponding coloured square under the “style” in your screenshot to get the same menu that @Knut Vidvei has shown.

Userlevel 3


I zoomed in and highlighted the option with a red box here:


Userlevel 3

Hi @eashwar11, did this help?