热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Excel数据透视图表线性时间尺度-Excelpivotchartlineartime-scale

Ihaveadataset(~10000rows)withthefollowingform:我有一个数据集(~10000行),格式如下:+------------------

I have a data set (~10000 rows) with the following form:

我有一个数据集(~10000行),格式如下:

+---------------------------+---------------+-------------+
| DateTimeCreated           | Machine       | ProductName |
+---------------------------+---------------+-------------+
| 2009-03-03 00:00:12.217   | COMP001       | Product001  |
+---------------------------+---------------+-------------+

I have graphed this using a pivot table and chart with the following layout

我已经用如下布局的数据透视表和图表绘制了这张图

Page: ProductName
Column:  Machine
Row: DateTimeCreated - Group by Day, Hour, Minute
Data: Count of DateTimeCreated

This all works correctly however the timescale of the resulting graph is not linear. For those minutes of the day where the event I am tracking did not occur these minutes do not show on the graph. The event I'm tracking also can go hours without occurring which results in an even more non-linear graph.

这一切都是正确的工作,然而结果图的时间尺度不是线性的。对于一天中我所跟踪的事件没有发生的那几分钟,这些分钟没有显示在图表上。我所跟踪的事件也可以持续数小时而不发生,这将导致更非线性的图形。

Here is an attempt to illustrate the x-axis of my graph:

下面是图中x轴的图:

|09|   10    |  11  |         12         |14| 16 |      18        |  20  |23|

The desired result is:

期望的结果是:

|00|01|02|03|04|05|06|07|08|etc

So each hour is the same size and is shown even if the event did not occurr (so on my Line graph the line simply goes to 0 for a while)

所以每小时都是一样的大小即使事件没有发生也会显示出来(因此在我的线形图上这条线只是在一段时间内趋于0)

Can this be achieved?

这个可以实现吗?

1 个解决方案

#1


1  

I changed my data set to look like this

我把数据集改成这样

+---------------------------+---------------+-------------+-------+
| DateTimeCreated           | Machine       | ProductName | Count |
+---------------------------+---------------+-------------+-------+
| 2009-03-03 00:02:00.000   | COMP001       | Product001  |   2   |
+---------------------------+---------------+-------------+-------+

so that the query is grouping the events by minute and providing the count in the minute

因此,查询将按分钟对事件进行分组,并在分钟内提供计数。

I then generated a second data set that contained an entry for every minute of the day but with a count of 0 As I was only working with 24hr data sets this was not unreasonable

然后我生成了第二个数据集,其中包含一天中每一分钟的条目,但计数为0,因为我只处理24小时的数据集,这并非不合理

Combining the two data sets gives a linear timeline on the pivot chart.

结合这两个数据集,在主图上给出一个线性时间线。


推荐阅读
author-avatar
塘迅人要更名_544
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有