Coder Social home page Coder Social logo

Graph with candles about envisionjs HOT 11 CLOSED

svieujot avatar svieujot commented on August 18, 2024
Graph with candles

from envisionjs.

Comments (11)

svieujot avatar svieujot commented on August 18, 2024

I found a way to get around this for the moment :
instead of passing values in the form [ [dates], [prices] ], my data is in the form [ [dates], [closing price], [ {o,h,l,c} ] ].
The I re-wrote the candle adapter to get the o,h,l,c from data[2].

I works for the moment, but the min/max are computed by envision only on the closing prices, so as long as the candles do not overflow the closing price too much, it is fine, but if the candles have "long tails", some part might not be displayed.
So it would be nice to have a way to overload the min & max calculation.

Thank you.

from envisionjs.

cesutherland avatar cesutherland commented on August 18, 2024

Ah, you want to skipPreprocess. There's an example of it here:

http://humblesoftware.com/envision/demos/ajax

Most any of the esoteric graph types like that, the user does not want to
downsample.

-c

On Tue, Aug 21, 2012 at 11:55 AM, Sylvain Vieujot
[email protected]:

I found a way to get around this for the moment :
instead of passing values in the form [ [dates], [prices] ], my data is in
the form [ [dates], [closing price], [ {o,h,l,c} ] ].
The I re-wrote the candle adapter to get the o,h,l,c from data[2].

I works for the moment, but the min/max are computed by envision only on
the closing prices, so as long as the candles do not overflow the closing
price too much, it is fine, but if the candles have "long tails", some part
might not be displayed.
So it would be nice to have a way to overload the min & max calculation.

Thank you.


Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-7905844.

from envisionjs.

svieujot avatar svieujot commented on August 18, 2024

Great. I will try this.
Thank you !

from envisionjs.

cesutherland avatar cesutherland commented on August 18, 2024

All set with this?

from envisionjs.

svieujot avatar svieujot commented on August 18, 2024

I did not try it yet.
Still tuning my multichart stuff.

from envisionjs.

svieujot avatar svieujot commented on August 18, 2024

I did not manage to use the skipPreprocess to solve this.
I understand how the skipPreprocess can be used to load data, but I don't see how this helps adjusting the axes ranges.
Anyway I can live without this for the moment, so I am closing the issue and will re-open it later if ever I need it.

from envisionjs.

cesutherland avatar cesutherland commented on August 18, 2024

I'll get together an example.

Maybe open a thread on the google group?

On Fri, Aug 24, 2012 at 8:48 AM, Sylvain Vieujot
[email protected]:

I did not manage to use the skipPreprocess to solve this.
I understand how the skipPreprocess can be used to load data, but I don't
see how this helps adjusting the axes ranges.
Anyway I can live without this for the moment, so I am closing the issue
and will re-open it later if ever I need it.


Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-8000289.

from envisionjs.

svieujot avatar svieujot commented on August 18, 2024

For the moment I solved it by adding this to my candle adapter :

extendYRange: function (axis, data, options) {
    var maxHigh = null, minLow = null;

    for (i = 0; i < data.length; i++) {
        var candleIndex = data[i][0];
        var qb = options.quotes[candleIndex];

        if( maxHigh === null || maxHigh < qb.h )
            maxHigh = qb.h;
        if( minLow === null || minLow < qb.l )
            minLow = qb.l;
    }

    if( maxHigh != null && minLow != null ){
        axis.max = Math.max( maxHigh, axis.max );
        axis.min = Math.min( minLow, axis.min );
    }
}

It will do it for some time.
The really nice thing would be to integrate the candle adapter within envision.

from envisionjs.

cesutherland avatar cesutherland commented on August 18, 2024

Ahh I understand! That's the correct solution, and an issue inside Flotr2.
Feel free to create a topic-branch and submit a pull request over there.
I'll incorporate it.

On Fri, Aug 24, 2012 at 1:45 PM, Sylvain Vieujot
[email protected]:

For the moment I solved it by adding this to my candle adapter :

extendYRange: function (axis, data, options) {
var maxHigh = null, minLow = null;

for (i = 0; i < data.length; i++) {
    var candleIndex = data[i][0];
    var qb = options.quotes[candleIndex];

    if( maxHigh === null || maxHigh < qb.h )
        maxHigh = qb.h;
    if( minLow === null || minLow < qb.l )
        minLow = qb.l;
}

if( maxHigh != null && minLow != null ){
    axis.max = Math.max( maxHigh, axis.max );
    axis.min = Math.min( minLow, axis.min );
}

}

It will do it for some time.
The really nice thing would be to integrate the candle adapter within
envision.


Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-8009622.

from envisionjs.

svieujot avatar svieujot commented on August 18, 2024

Ok, I will do that.
One issue is that to work properly with envision, I customized my dataset :
data[0] = x
data[1] = y
data[2] = {o:..., h:..., l:..., c: ...., v:....., d:....} // JSON for the full candle info : open, high, low, close, volume, date

That way it works with minimal changes in Envision.
I will submit the pull request as it works for me now, but you might have different views on the input parameters.

from envisionjs.

svieujot avatar svieujot commented on August 18, 2024

Pull request done.

from envisionjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.