Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use milliseconds in "X Axis Format" for "Time Series - Line Chart" #3192

Closed
khotkevych opened this issue Jul 27, 2017 · 10 comments
Closed

Use milliseconds in "X Axis Format" for "Time Series - Line Chart" #3192

khotkevych opened this issue Jul 27, 2017 · 10 comments

Comments

@khotkevych
Copy link

I have a DATETIME field with "%Y-%m-%d %H:%M:%S.%f" time format (with milliseconds).
And I have records in the table formatted this way.
What I want is to use the same time format during visualization. Milliseconds included.
There is no option with milliseconds in "X Axis Format" for "Time Series - Line Chart", so I've tried to create one: "%Y-%m-%d %H:%M:%S.%f"

Expected results

Values with milliseconds appears on the chart. Like: "2019-01-14 01:32:10.100"

Actual results

"f" instead of milliseconds appears. Like: "2019-01-14 01:32:10.f"

Superset version

0.18.4

Steps to reproduce

  1. Create Time Series - Line Chart visualization
  2. Change X Axis Format to %Y-%m-%d %H:%M:%S.%f
  3. Query
@mistercrunch
Copy link
Member

According to this https://github.com/d3/d3-3.x-api-reference/blob/master/Time-Formatting.md, you can specify mills with %L, so %Y-%m-%d %H:%M:%S.%L

@andyComeOn
Copy link

Hi,u question has resolved? I want discuss a question with u. See 1 floor Contributor say "the way". When we click a anchor , then , it enter a child page,how the svg drew ? i think svg get data then drew,but where is code,i can't find it.

@xrmx
Copy link
Contributor

xrmx commented Jul 28, 2017

@andyComeOn please don't hijack other issues

@khotkevych
Copy link
Author

I've tried %Y-%m-%d %H:%M:%S.%L format as @mistercrunch mentioned.
But now I have .000 as a milliseconds for each value in the chart.
Here is the real data:

selection_011
Here is the result I have:

explore admin-default-untitled query-syxvqtpd8z - mozilla firefox_012

Should admit that the X Axis Labels are not formatted well.

Maybe I need to configure this time field in some special way in the Edit Sqla Table section?
Now I only change the Type to a DATETIME. Should I specify some Database Expression ?

@mistercrunch
Copy link
Member

Seems to be working well with the table, I wonder if nvd3 is truncating it. What does you Time section look like? What does the SQL query look like? If the output of the query has the millis, I'm guessing nvd3 somehow would be truncating the millis?

@khotkevych
Copy link
Author

Here is my Time section:
selection_013
And here is visualization Query:

SELECT processed_at AS __timestamp,
       sum(bytes) AS sum__bytes
FROM
  (SELECT bytes,
          processed_at
   FROM bad_ip
   where src="localhost"
     or dst="localhost"
   order by processed_at) AS expr_qry
WHERE processed_at >= '1917-07-31 13:49:56'
  AND processed_at <= '2017-07-31 13:49:56'
GROUP BY processed_at
LIMIT 50000

As you can see in my post above, query result contains milliseconds.

@mistercrunch
Copy link
Member

Oh you have no time grain option? Which database engine is this?

@khotkevych
Copy link
Author

I'm connecting to Impala.
The data is stored in Kudu.

@mistercrunch
Copy link
Member

Here: this should help:
#3225

Can you build this branch and check if it works?

@mistercrunch
Copy link
Member

Notice: this issue has been closed because it has been inactive for 264 days. Feel free to comment and request for this issue to be reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants