Giter Club home page Giter Club logo

Comments (7)

nperony avatar nperony commented on August 11, 2024

Hi, another Pyxley user here. At Tamedia Digital (Zurich), the data science team is planning to use Pyxley for quick dashboard implementation. We'd love to see datetimes supported for line charts. Thanks!

from pyxley.

sanjeevbhalla avatar sanjeevbhalla commented on August 11, 2024

Another user who is using Pyxley and ran into this same issue. One should be allowed to specify the date format of the data.

from pyxley.

nmkridler avatar nmkridler commented on August 11, 2024

I think the problem is that I'm casting a string to a Date. You should be able to format however you like, it just needs to be a string when it's transmitted to the javascript. I can probably force that in the default request function.

from pyxley.

sanjeevbhalla avatar sanjeevbhalla commented on August 11, 2024

No. I tried string and it did not work. If I recall right the problem is
that the MG date formatting function that is called from d3 expects a
format and without a format passed it assumes a default of Y M and D. That
is my recollection when I tried to understand whats going on.

Thanks

On Thu, Jan 7, 2016 at 8:23 AM, Nick Kridler [email protected]
wrote:

I think the problem is that I'm casting a string to a Date. You should be
able to format however you like, it just needs to be a string when it's
transmitted to the javascript. I can probably force that in the default
request function.


Reply to this email directly or view it on GitHub
#17 (comment).

from pyxley.

nmkridler avatar nmkridler commented on August 11, 2024

Here's the javascript code that does the conversion.

    _update: function(params) {
        d3.json(this.props.options.url.concat("?",$.param(params)),
            function(error, data){
                var options = this.props.options.params;
                if(data.date){
                    for(var i=0; i < data.result.length; i++){
                        data.result[i] = MG.convert.date(data.result[i], "x");
                    }
                }
                options.data = data.result;
                MG.data_graphic(options);
            }.bind(this));
    },

https://github.com/stitchfix/pyxleyJS/blob/master/src/metricsgraphics.js

I'll have to look in to it and try it with different date formatting.

from pyxley.

sanjeevbhalla avatar sanjeevbhalla commented on August 11, 2024

Right. On this line data.result[i] = MG.convert.date(data.result[i], "x"); is
called to convert Date. But because no format is passed it uses default
format of %Y-%m-%d

https://github.com/mozilla/metrics-graphics/wiki/Convenience-Functions
Converts a data object's values from strings to javascript Date objects
that can then be plotted. The function parses %Y-%m-%d-styled timestamps by
default. An optional third argument allows one to specify an alternative
style, per the formats defined here:
How do I as user of Pyxley override this behavior? (Sorry if I am missing
something obvious - I am not a Javascript expert).

Thanks for your help.

On Thu, Jan 7, 2016 at 8:47 AM, Nick Kridler [email protected]
wrote:

Here's the javascript code that does the conversion.

https://github.com/stitchfix/pyxleyJS/blob/master/src/metricsgraphics.js


Reply to this email directly or view it on GitHub
#17 (comment).

from pyxley.

markosole avatar markosole commented on August 11, 2024

This worked for me:

for(var i = 0; i < data.length; i++) {
                    data[i] = MG.convert.date(data[i], 'date', '%Y-%m-%dT%H:%M:%SZ'); 
 }

My date in database looks like this: 2018-04-28T13:24:55Z

from pyxley.

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.