Home
Analytics
line segments with missing connections
JDH
I need to build a chart that has a line created by connection a series of data points. This is easily done.
My problem is that some of my data is disconnected. That is, I have the following:
Point 1 has coordinates (x1, y1)
Point 2 has (x2, y2)
Point 3 has (x3, y3)
Point 4 has (x4, y4)
I want to connect point 1 to point 2 and point 3 to point 4. I don't want point 2 connected to point 3.
From what I read there is an option to not connect null points. So, do I create an artificial point 5 as (x5, y5) where x5 and y5 are null then connect point 2 to point 5 and then point 5 to point 3. I assume only the y coordinate has to be null is that correct?
This seems like a common problem and the above solution seems like more than can easily be done with just a query. I could have individual series that contain only a series of points that are connected but I don't know A priori how many pairs of segments I might have for a given report so I would have no way of determining how many series to set up.
Is there an easier way to handle this issue?
Thanks for any help you can provide.
Find more posts tagged with
Comments
mwilliams
Hi John,
So, you want to be able to pass values to a chart and only connect every set of two? i.e. 1-2, 3-4, 5-6, etc? I'm not sure if you can play with the visibility of the line or not. Can you explain more about the application of the chart?
JDH
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="75110" data-time="1301331716" data-date="28 March 2011 - 10:01 AM"><p>
Hi John,<br />
<br />
So, you want to be able to pass values to a chart and only connect every set of two? i.e. 1-2, 3-4, 5-6, etc? I'm not sure if you can play with the visibility of the line or not. Can you explain more about the application of the chart?<br /></p></blockquote>
<br />
I have a device that consumes paper (the Y coordinate) as time goes on (the X coordinate). If I simply sampled at random intervals I would get a set of (x,y) coordinates that I could graph using BIRT quite easily. <br />
<br />
However, my device has 3 states instead of one like the example above. Let's call them feed, print and offline. Each state needs to be a different color. Feed is blue, print is green and offline is red. The device moves between the feed, print and offline states as time goes on. I want to draw a line that is blue when the machine is in the feed state, green when the machine is in print state and blue when the machine is in off-line state.<br />
<br />
Here is some sample data:<br />
<br />
X Y Color<br />
0 0 B <br />
2 5 G<br />
9 23 B<br />
12 26 G<br />
15 31 B<br />
32 45 G<br />
35 51 R<br />
43 64 B<br />
<br />
So, I need to draw a blue line from (0,0) to (2,5). Then a green line from (2,5) to (9,23). Then a blue line from (9,23) to (12,26). Then a green line from (12,26) to (15,31). Then a blue line from (15,31) to (32,45). Then a red line from (32,45) to (35,51). Then a blue line from 35,51 to 43,64). And so forth.<br />
<br />
So, the graph shows at any particular time what state the device is in (by the color of the current line) as well as how much paper has been consumed at that time by the Y axis value. <br />
<br />
Does that help in understanding what I need to accomplish?
mwilliams
Yes, I understand exactly what you mean now. What is your BIRT version? I'll see if there is something I can figure out on this. I think I've worked with this before in an older version and I remember the series point's color being able to be changed, but not being able to change the color of the connecting line or something like that, but maybe something has changed since then. Let me know your version and I'll take a look.
JDH
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="75169" data-time="1301410357" data-date="29 March 2011 - 07:52 AM"><p>
Yes, I understand exactly what you mean now. What is your BIRT version? I'll see if there is something I can figure out on this. I think I've worked with this before in an older version and I remember the series point's color being able to be changed, but not being able to change the color of the connecting line or something like that, but maybe something has changed since then. Let me know your version and I'll take a look.<br /></p></blockquote>
<br />
<br />
Michael,<br />
I am the BIRT Framework 2.6.1.v20100709a-9iF7A8FGLY4z0pxX3ORrsdrp6JXb. The full download for Eclipse.
mwilliams
It is possible to change the line in script, but it doesn't look like there's a way to change each segment. You could file an enhancement request for a feature like this in later versions at
http://www.birt-exchange.org/org/resources/bug-reporting/
JDH
Michael,
Thanks for your help. I, of course, cannot wait for a feature to be developed.
I did find I way to do this and it works mostly. I had to modify the results of my query to make it work. Here is what my data looks like after modification.
Index 0 1 2 3 4 5 6 7 8 9 10 11 12 13
Time T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14
Feed 0 20 N N 30 35 N N 50 60 N N 60 100
Print N N 20 30 N N 35 50 N N N N N N
Off-line N N N N N N N N N N 60 60 N N
Index represents the index into the data table.
Feed (blue), print (green) and off-line (red) represent the 3 series (line segments) I want to draw. Each of these have a different color. These points represent the Y axis values. The Y axis is the amount of paper passing through the printer in feet.
Time repesents the X axis values for each of the series.
This will draw a chart as follows:
A blue line from (T1, 0) to (T2, 20)
A green line from (T3, 20) to (T4, 30)
A blue line from (T5, 30) to (T6, 35)
A green line from (T7, 35) to (T8, 50)
A blue line from (T9, 50) to (T10, 60)
A red line from (T11, 60) to (T12, 60)
A blue line from (T13, 60) to (T14, 100)
The result of these line segments graphed together is a colored line across time that shows how much paper is passing through the printer. The colors give the use a sense of what the printer is doing at any time. If the chart has a lot of red the machine is not being used efficiently. If the chart has a lot of blue then paper is being wasted.
Now to the problems that remain.
1.) BIRT does not seem to like to draw vertical lines. If the first segment is a vertical line, that is, (T0, 5) to (T0, 20) I get a dot a (T0, 20) and now line connecting it to (T0, 5). This seems like a bug.
It also occasionally has trouble drawing horizontal lines. As long as the lines have slope other than 0 or infinity then BIRT seems to be OK with them.
2.) BIRT does not scale correctly for small amounts of data. If I draw a segment where the X axis is time and the Y axis is a large number as here:
(2011-10-03 11:55:21, 934567890) to (2011-10-03 11:55:23, 934589884)
I get a graph scaled from 0 to 1000000000 with a dot near the top.
But, if a put a series of points in across several minutes of elapsed time with Y axis values in the 9xxxxxxxx range then it scales them very nicely. This seems like another bug.
I did not realize this submission process removed spaces so my example tables look terrible.
mwilliams
John,
Please log bugs for these issues at the link I posted above. Thanks!