I am using a Line Chart widget in ThingWorx Mashup to display time-series data. I would like to add a trend line (for example: linear trend / moving average) on top of the existing line chart to show the overall trend of the data.
Is there any built-in option in ThingWorx Line Chart to enable a trend line?
If not, what is the recommended approach to implement a trend line?
Solved! Go to Solution.
Hi @SG_14220535
ThingWorx does not have a built-in option to add trend lines directly to the Line Chart widget. To implement a trend line, you can consider the following approaches:
Data Preprocessing: Calculate the trend line data (e.g., linear regression or moving average) in your data source or service before sending it to the Line Chart. This way, you can plot the trend line as a separate series on the same chart.
Custom JavaScript: If you are comfortable with coding, you can use custom JavaScript to manipulate the chart data and draw a trend line using a library like Chart.js or D3.js, which can be integrated into ThingWorx.
Use of Additional Widgets: You can create a separate widget for the trend line and overlay it on the existing Line Chart, ensuring that both datasets are synchronized in terms of time intervals.
Regards.
--Sharon
Hi @SG_14220535
ThingWorx does not have a built-in option to add trend lines directly to the Line Chart widget. To implement a trend line, you can consider the following approaches:
Data Preprocessing: Calculate the trend line data (e.g., linear regression or moving average) in your data source or service before sending it to the Line Chart. This way, you can plot the trend line as a separate series on the same chart.
Custom JavaScript: If you are comfortable with coding, you can use custom JavaScript to manipulate the chart data and draw a trend line using a library like Chart.js or D3.js, which can be integrated into ThingWorx.
Use of Additional Widgets: You can create a separate widget for the trend line and overlay it on the existing Line Chart, ensuring that both datasets are synchronized in terms of time intervals.
Regards.
--Sharon
Hi @SG_14220535
If my previous response was helpful, please mark it as the Accepted Solution for the benefit of others in the community.
If you still have questions, please let us know.
Regards.
--Sharon
