Project

General

Profile

Support #8526

Widget example code for Constellation plot

Added by Someshwar DK about 1 month ago. Updated about 1 month ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
05/17/2021
Due date:
% Done:

0%

Estimated time:

Description

Hello Team,

I am in process of building a Frontend for displaying statistics from our backend server.

I receive data for plotting constellation on the cartesian plane. With Scatter-Plot, I see that the (x,y) coordinates connect with a line, but with our requirement, we only want the coordinate dots to be plotted.

Attaching an example output to get as Red dots,

Please help me with below,

  1. Is it possible to plot dots as above?
  2. Which widget do I use to achieve this? Please point me to some documentation
  3. Please point me to some example code for plotting the constellation

thanks--
Somesh


Files

clipboard-202105171524-rbq1b.png (57.4 KB) clipboard-202105171524-rbq1b.png Someshwar DK, 05/17/2021 11:54 AM
constellation.gif (6.44 KB) constellation.gif Example of live plot of constellation points Someshwar DK, 05/19/2021 07:19 AM
#1

Updated by Korneel Dumon about 1 month ago

Yes, this is possible, have a look at the documentation for WDataSeries. More specifically

  • setType() allows you to plot points without lines
  • setMarker() / setMarkerSize() allows you to make big circle markers
  • setLabelsEnabled() for the labels

There is pretty extensive charts example here: https://www.webtoolkit.eu/wt/examples/charts/charts.wt. The source code for this is included in Wt.

#2

Updated by Someshwar DK about 1 month ago

Thanks for your prompt response. I will check out the examples, class and the mentioned routines.

-s

#3

Updated by Someshwar DK about 1 month ago

Hello Korneel,

I was able to get the above plot using the example you pointed out.

I have a few more questions,

  1. Can the constellation points on the Cartesian plane be updated periodically and be shown as a Live plot?
  2. The example uses WStandardItemModel class to take in 40 coordinates and plot them. Can we periodically call WCartesian::setModel() routine to show new plotted points in the chart?

Basically, we keep getting new coordinates from the backend 4/5 times in a second and we want the Frontend to keep refreshing/updating whenever new data is loaded. We want to show the latest data and keep refreshing it to show as a Live updating Chart.

Please suggest the right approach.

thanks--
Somesh

#4

Updated by Korneel Dumon about 1 month ago

Hi,

nice to see it's working for you. You can do live updates with server-push. See WApplication::enableUpdates() for some documentation. There is also an example called serverpush.

#5

Updated by Someshwar DK about 1 month ago

I was able to use the below routines to update the data-set and see the Chart getting updating Live,

itemModel()
setData()

thanks--
Somesh

Also available in: Atom PDF