[英]Date Axis in a Telerik Reports Line Graph
Does anyone know how to set up a date time axis to use DateTime Scale in a line graph in Telerik Reports? 有谁知道如何设置日期时间轴以在Telerik Reports的折线图中使用DateTime Scale? I have been trying to figure it out for over a week now. 我已经尝试找出一个多星期了。 I don't understand why this thing has to be so difficult to use. 我不明白为什么这个东西必须这么难使用。 I started by setting up a line graph. 我从设置折线图开始。
I have three columns DATE, SALES_COUNT, and SALES_TYPE. 我有三列DATE,SALES_COUNT和SALES_TYPE。 I want there to be three lines on the graph. 我希望图表上有三条线。 One for each value of SALES_TYPE. 每个SALES_TYPE值一个。 I used SALES_TYPE for the series, SALES_COUNT for the value, and since I didn't have any other options left, I used DATE for Categories. 我将SALES_TYPE用于该系列,将SALES_COUNT用于该值,并且由于我没有其他选择,因此我将DATE用于Category。 I clicked finish and previewed my graph. 我单击完成并预览了我的图形。 The graph looked right except I wanted to make a few customization to the DATE axis. 该图看起来不错,只不过我想对DATE轴进行一些自定义。 Specifically I only wanted it to write out a date label for every 5 ticks or so. 具体来说,我只希望它每隔5个滴答声写出一个日期标签。 There was no way to do this. 没有办法做到这一点。
Eventually I figured out that I have to set the axis to use DateTime Scale since it defaults to Category Scale. 最终,我发现必须将轴设置为使用DateTime Scale,因为它默认为Category Scale。 I set it to date time scale and previewed the graph again. 我将其设置为日期时间刻度,并再次预览了该图。 I got the error: "X value cannot be null or empty when using DateTimeScale, lineSeries1", so I went to lineSeries1 and set the X value to "= Fields.DATE", and clicked preview. 我收到错误消息:“使用DateTimeScale,lineSeries1时X值不能为null或为空”,因此我转到lineSeries1并将X值设置为“ = Fields.DATE”,然后单击预览。 Now the graph nolonger displays any of my data points, and there is only one tick on the DateTime axis and its labeled as 1/1/2015 12:00:00 AM, a DateTime that is not even in my dataset. 现在,该图不再显示我的任何数据点,并且DateTime轴上只有一个刻度,其标记为1/1/2015 12:00:00 AM,这个DateTime甚至不在我的数据集中。 I have been struggling for over a week now to figure out how to do this simple task. 我一直在努力一个多星期,以找出如何完成此简单任务。 Please help me. 请帮我。
The SQL query I was using was handed to me by the DBA. 我正在使用的SQL查询是由DBA交给我的。 I never really looked at it, I just stuffed it into the report. 我从来没有真正看过它,只是将其填充到报告中。 It turns out the query was returning the DATE column as a varchar. 事实证明,查询将DATE列作为varchar返回。 Once I cast the DATE column as a date in the select column list of the query, Setting the axis to use DateTime Scale worked fine. 一旦将DATE列转换为查询的选择列列表中的日期,将轴设置为使用DateTime Scale即可正常工作。 If anyone else runs into a similar problem, check the return types of your columns. 如果其他人遇到类似问题,请检查列的返回类型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.