Algorithm to determine when to display points on a line graph - algorithm

I have a system that collects statistics from servers for every 5 minutes and displays a line graph using dhtmlxChart as shown below. I want to add points to the graph when there are significant change of the trend in the statistics, for example when the line graph looks like saw teeth from 00:00 to 06:00 in the image below, the graph will display square points at the periodical high and low values. As you can see, my existing algorithm does not work well.
interate over each point:
if last visible point not defined then:
set current point as visible
store current point as last visible point
else:
compare absolute difference between last visible point and current point
if difference exceeds threshold or current point is the last point then:
set current point as visible
store current point as last visible point
What would be a correct algorithm to determine the visible points in the line graph?

There is no way to add points, but you can redraw the chart using updated data source.
Look at the samples from this theme
You can use your "line" chart type

Related

How to do the animated parametric plot with non-static trail

Application used: everycircuit
Example circuits used (the book icon in the left sidebar):
: "LED Array", "RC step response"
So,
the image is of a parametric plot of some quantities on vertical axis (legend indicated by #3 in image), and one quantity on horizontal axis (legend indicated by #2)
in this, there's one parameter with respect to which all values are changing (which is time)
in the plot, the trail of values is kept for some time then it is erased - the keeping behaviour helps when the system is stable, and the erasing helps a lot to declutter the plot and zoom into the new relevant area/scale when the system changes its characteristics
How to do this animation in other code based data analysis software? like python/octave/julia etc?
Animation i.e.
the values changing with change in the parameter (i.e. the normal plot),
but the trail shown for only some time (hence, non-static)
while still retaining some way to change the parameter, and see which point corresponds to that (also known as "track" the plot)

Drawing custom paths in D3.js without using fake data points

Trying to implement EKG style "heartbeat" chart from a design and I'm having a hard time getting D3 to draw a path like I need.
The design spec states that the graph needs to return to nuetral/zero point between each and every data point, and that the curved path from the zero point should be close to the data point itself and rise sharply. See the attached images below
Here is the design....
And here is my attempt to match the curve with dummy data (black circle data points)...
The graph has a time scale X axis and a linear Y axis that ranges from 0 to 2 (my data points are 0,1, or 2 respectively). The line is using 'monotone' interpolation which is the least terrible looking.
Question:
Is there a better way to get this appearance without dummy data points?
Question-behind-the-question:
What is the best way to get D3 draw a custom paths (e.g. from a function)?
Sub-question:
Why does the monotone interpolation curve the path inward so sharply between the last 2 data points?
Any help is appreciated! The designers and client won't budge on this one, so I have to get it as close possible :(

Changing point size in autocad

I don't know if its right forum. I'm posting question related to autocad. So please share link of forum (if I'm not allowed to ask it here)
How can I change point size (single point size 1/2/3) of point cloud (imported as pcg) in autocad.
POINT Command
Creates a point object
Draw menu: Point
Command line: point
Specify a point:
Points can act as nodes to which you can snap objects. You can specify a full three-dimensional location for a point. The current elevation is assumed if you omit the Z coordinate value.
The PDMODE and PDSIZE system variables control the appearance of point objects. PDMODE values 0, 2, 3, and 4 specify a figure to draw through the point. A value of 1 specifies that nothing is displayed.
Specifying the value 32, 64, or 96 selects a shape to draw around the point, in addition to the figure drawn through it:
PDSIZE controls the size of the point figures, except for PDMODE values 0 and 1. A setting of 0 generates the point at 5 percent of the drawing area height. A positive PDSIZE value specifies an absolute size for the point figures. A negative value is interpreted as a percentage of the viewport size. The size of all points is recalculated when the drawing is regenerated.
After you change PDMODE and PDSIZE, the appearance of existing points changes the next time AutoCAD regenerates the drawing.

How can I pick an intelligent location from a list of points/coordinates on 2D tile map?

So I have an arrayList of the locations of each pixel (represent resources in my game). arrayList.get(0); would get me the top right point, and then continuing by increment the x coordinate. When it reaches the end, it increments the y coordinate and repeats until it gets to the last point (left-most, bottom)/end of the list.
I want to build a factory site, but first I need to pick an intelligent location to build my factory/resource site. See picture (red is an ideal location).
If I simply take an average of all points, it would give me somewhere around orange arrow (I'm guessing).
Sounds like you're looking for the highest point density. This StackOverflow answer discusses a couple of algorithms, the first doing box convolution.
Of course if each pixel just has value 1 this may be more than you need.

d3.js forced directed graph effects on enter

I use d3.js exactly as shown here but with different data value.
When the graph is first shown all elements are scattered and for around a second rapidly move towards their position. This looks nice in the sample, but for my data it does not look so nice. Any way to turn it off so that nodes start in their designated place? Any way to customize this entry visualization?
You can loop through the nodes array and set the .x/.y and .px/.py values to an initial position that you want the nodes in, and by doing so will limit the amount they need to move in their initial layout. If you turn off the force-directed algorithm (the tick() function) then you can apply standard .transtion().duration(500).attr("transform", xx) behavior to the nodes and links to make them animate in a manner you prefer before or after running the force-directed algorithm, but make sure you set the .x/.y and .px/.py attributes to their final position, otherwise they will be reset as soon as you .tick()

Resources