Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Recognizing Trends In Line-Charts

pseudocode

  • Please log in to reply
3 replies to this topic

#1 Newbie22

Newbie22

    CC Lurker

  • New Member
  • Pip
  • 3 posts
  • Programming Language:Java, PHP, PL/SQL, Bash

Posted 08 July 2012 - 07:31 AM

does anybody know an algorithm to recognize trends in 2-D Line charts? Something that, for example in the attached chart returns an array with coordinate-Pairs A/B and B/C?
(Pseudocode answers prefered)

Attached Thumbnails

  • chart-exp.gif

  • 0

#2 BlackRabbit

BlackRabbit

    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts
  • Location:Argentina
  • Programming Language:C, C++, C#, PHP, JavaScript, Transact-SQL, Bash, Others
  • Learning:Java, Others

Posted 09 July 2012 - 10:52 AM

I don't know any algorithm that does what you need. still i have a pretty good idea on how should that be done.

First words : image processing
Second : color recognition
third : axis recognition
forth : units percentual

First to do: recognize background color from line color
second : collect x-y data for each color ( thinking you will have more than one line and color )
third : configure or establish graphic's axis and assign one as the time line and the other as values, in this case X is time, Y is value (which i think will cover at least 90% of the cases so detecting that wouldn't be something prioritary )

now that you got that, take the value axis and establish amplitude ( subtract lower peak value from higher peak value)
that amplitude is your 100%, the convert the coordinates values to percent of amplitude values, like this :

30,35,60,70,56,55,50

that would mean that those points represent 30% of the amplitude, 35%, 60%, etc

having that you can scale the graph however your want, and if you get the right 100% value in proper unit as in top peak is 300 dollars or 500 meters, then you will be able to do easy chart readings :D

if by any chance you have the scale printed on the graph then bingo !, you got it all wrapped :D

sorry if the explanation is not very elegant, but my head is thinking at top speed and my fingers ... are just human fingers

anyway, once you get it done i would like to have a peek to your algorithm :D

hope this helps !
  • 0

#3 Newbie22

Newbie22

    CC Lurker

  • New Member
  • Pip
  • 3 posts
  • Programming Language:Java, PHP, PL/SQL, Bash

Posted 12 July 2012 - 04:08 AM

thx for the answer.
I dont have to do any image processing, the coordinate values are already in a DB.
I dont see how scaling the diagramm is of any help, maybe i wasnt clear enough: i'm looking for an algorithm, that automatically detects subsequent points of the chart, which "belong" together, because they more or less point at the same direction (in opposition to other "trends", in the picture above one trend would be from A to B and one from B to C) and have a similar volatility. Scaling wouldnt ease this detection at all, the task remains exactly the same.
Hope i didnt cause more confusion now.
  • 0

#4 BlackRabbit

BlackRabbit

    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts
  • Location:Argentina
  • Programming Language:C, C++, C#, PHP, JavaScript, Transact-SQL, Bash, Others
  • Learning:Java, Others

Posted 12 July 2012 - 01:05 PM

oh, i thought you wanted to read the graphic and the pass it to numeric data,
in that case i would suggest you to simplify the data display in your database implementing a proximity algorithm, for starters you should define your data-proximity window, and point by point erase the contiguous points who are inside that window, then you should decide if you want to keep peaks only or tendencies too.

still, first of all what you need to figure out is looking at that graph, what is the exact output you want, in base of that we can talk algorithms
  • 0





Also tagged with one or more of these keywords: pseudocode

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download