- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在向用户显示一个图表,其中有一个带有折线图的图表区域。例如,在这一点上,我得到了一行。该行有大约 200 个值。这些值都有描述(例如 "01.01.2013"
、 "05.02.2013"
等等)。
显示图表时,我只能看到两个描述,即使会有更多描述的空间。该线显示正确,但只描述了两点。
我垂直旋转了文本,因此有更多空间,但这没有帮助。如果我显示较少的值(5 或 10),说明会正确显示。
这就是它的实际外观(描述实际上是字符串,而不是日期)。
感谢您的帮助!
编辑 :我的代码:
chart.ChartAreas(0).AxisY.Maximum = 6
chart.ChartAreas(0).AxisY.Minimum = 1
chart.ChartAreas(0).AxisX.LabelStyle.Angle = -90
chart.Series.Clear()
chart.ChartAreas(0).AxisY.StripLines.Clear()
Dim myStripLine1 as new StripLine()
myStripLine1.IntervalOffset = 4
chart.ChartAreas(0).AxisY.StripLines.add(myStripLine1)
'now adding all series
chart.Series.Add("Chemie") 'just to take the example in the image above
chart.Series(chart.Series.Count - 1).ChartType = DataVisualization.Charting.SeriesChartType.Line
chart.Series(chart.Series.Count - 1).BorderWidth = 4
'now adding quite much values (on every date, every Serie has a value)
chart.Series(chart.Series.Count - 1).Points.AddXY("01.03.2011", 4.9)
"01.01.2013"
上有两个值(6 和 4)和
"03.01.2013"
.另一个系列在
"01.01.2013"
上有 3 个值 (4,6,5.5) ,
"02.01.2013"
和
"03.01.2013"
.当我只显示它们时,第一个系列将在第二个日期结束,即使第三个日期有一个值。我通过在日期为
"02.01.2013"
的第一个系列中填充一个虚拟值来解决这个问题。这只是此时的平均值 (=5)。这一点根本不会用标记项目符号突出显示。这就是我绘制图形的方式。
MainForm.grades
是
Dictionary(Of Integer,Dictionary(Of String, String))
其中包含大约 150 个等级
Dim subjects As New Dictionary(Of Integer, ArrayList)
Dim allgrades As New ArrayList
For Each grade In MainForm.grades
Dim cD As New Dictionary(Of String, String)
cD.Add("SUBJECTID", grade.Value("SUBJECTID"))
cD.Add("GRADE", grade.Value("GRADE"))
cD.Add("DATE", grade.Value("DATE"))
allgrades.Add(cD)
Next
cht_main.ChartAreas(0).AxisX.IntervalType = DateTimeIntervalType.Days
cht_main.ChartAreas(0).AxisX.LabelStyle.Angle = -90
Dim gradesDateSorter = New gradesDateSorter()
allgrades.Sort(gradesDateSorter)
For Each grade In allgrades
If Not subjects.ContainsKey(Integer.Parse(grade("SUBJECTID"))) Then
subjects.Add(Integer.Parse(grade("SUBJECTID")), New ArrayList)
End If
Dim gradeDict As New Dictionary(Of String, String)
gradeDict.Add("DATE", grade("DATE"))
gradeDict.Add("GRADE", grade("GRADE"))
subjects(Integer.Parse(grade("SUBJECTID"))).Add(gradeDict)
Next
For Each subject In subjects
'adding serie
cht_main.Series.Add(MainForm.subjects(subject.Key)("NAME"))
cht_main.Series(cht_main.Series.Count - 1).ChartType = DataVisualization.Charting.SeriesChartType.Line
cht_main.Series(cht_main.Series.Count - 1).BorderWidth = 4
'cht_main.Series(cht_main.Series.Count - 1).IsXValueIndexed = True
For Each grade In subject.Value
cht_main.Series(cht_main.Series.Count - 1).Points.AddXY(Date.Parse(grade("DATE")), Double.Parse(grade("GRADE")))
Next
Next
IsXValueIndexed=True
因为当我激活它时,图表会生成一个大的红色错误十字。
chart.ChartAreas(0).AxisX.Interval = 1
最佳答案
是的,我同意迈克尔的看法。我现在只能补充说明。
通过设置您的间隔:
myStripLine1.IntervalOffset = 4
chart.ChartAreas(0).AxisX.Interval = 1
DateTimeIntervalType.Days
'Declaration
Public Sub Add( _
labelsStep As Double, _
intervalType As DateTimeIntervalType, _
format As String _
)
End Sub
chart.ChartAreas(0).AxisX.IntervalType = DateTimeIntervalType.Days
'which as shown in Michael's answer is parsed to string.
Dim format as String = "MM.dd.yyyy"
Dim actualDate as Date = Date.ParseExact(yourDate, format)
mySeries.XValueIndexed = True
Each data point in a series has X and Y values that determine its position in the plotting area. With some charts, the X value of points is not important, and does not have to be provided. In this case, the point positions in the plotting area are determined only by their point index (i.e. their location in the Points collection) and their Y values.
When X values are "indexed", the data point index, not a point's X value, is used to determine the position of points along the categorical (X) axis. For example in Figure 1 below, two charts are shown displaying the same data. However, the first chart uses non-indexed X values, therefore the X values of those points determine their location along the x-axis. The second chart is indexed, therefore its point indices are used to determine their position along the x-axis. In this case the X values are only used for the axis labels, and nothing more.
On every date, a new point gets entered for all series, but only those points where they have important values get highlighted
For example, assume you wish to create a re-occurring StripLine to highlight weekends. You set the interval to 7 and its type to Days. Since the first point is Sunday you set the IntervalOffset to 6 (to mean the 6th day of the week) and its type to Days. The resulting chart does not show the first StripLine.
A good rule of thumb to follow when using the Interval and IntervalOffset properties of the Chart is that the IntervalOffset should be a lower interval magnitude than the Interval (ie. Interval Days / IntervalOffset Hours, Interval Years / IntervalOffset Months, etc.).
Florian, can you pls show the code for the labels, properties etc of the x-axis? – yvytty yesterday
Did you ever consider 3rd party plotting components, such as ZedGraph ? Most likely such little caveats are already covered there. Give it a shot! – Neolisk yesterday
Hi can I clarify, you WANT to plot values daily? I think I have your solution, just need clarification, you have all the tools within vb.net
@yvytty, nope, the dates do not have to be daily, there can also be no value for a long time and I don't want a big span in my chart where no data is. Actually, I could also write some sample text at the X axis values, the dates are only confusing. The main problem is that the VB chart somehow calculates a very big margin on those descriptions at the X axis
DateTime.ParseExact
方法
Dim dateString, format As String
Dim result As Date
Dim provider As CultureInfo = CultureInfo.InvariantCulture
Parse date and time with custom specifier.
dateString = "Sun 15 Jun 2008 8:30 AM -06:00"
format = "ddd dd MMM yyyy h:mm tt zzz"
result = Date.ParseExact(dateString, format, provider)
The DateTime.ToString(IFormatProvider) method returns the string representation of a date and time value using the short date and long time pattern of a specific culture. The following example uses the DateTime.ToString(IFormatProvider) method to display the date and time using the short date and long time pattern for the fr-FR culture.
Dim date1 As Date = #3/1/2008 7:00AM#
Console.WriteLine(date1.ToString(System.Globalization.CultureInfo.CreateSpecificCulture("fr-FR")))
' Displays 01/03/2008 07:00:00
'note
Imports System.Globalization
Dim format as String = "dd.MM.yyyy"
Dim actualDate as Date = Date.ParseExact(yourDate, format, provider)
chart.ChartAreas(0).AxisX.LabelStyle.Format ="dd.MM.yyyy"
cht_main.ChartAreas(0).AxisX.IntervalType = DateTimeIntervalType.Days
cht_main.ChartAreas(0).AxisX.Interval = 1
Double.Parse(grade("GRADE")
'grade is not of type double
关于vb.net - 图表 : Show more value descriptions on X-Axis,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16708974/
我正在尝试使用 flot 绘制 SQL 数据库中的数据图表,这是使用 php 收集的,然后使用 json 编码的。 目前看起来像: [{"month":"February","data":482},
我有一个来自 php 行的 json 结果,类似于 ["value"]["value"] 我尝试使用内爆函数,但得到的结果是“value”“value” |id_kategori|created_at
脚本 1 将记录 two 但浏览器仍会将 select 元素呈现为 One。该表单还将提交值 one。 脚本 2 将记录、呈现和提交 两个。我希望它们是同义词并做同样的事情。请解释它们为何不同,以及我
我的python字典结构是这样的: ips[host][ip] 每行 ips[host][ip] 看起来像这样: [host, ip, network, mask, broadcast, mac, g
在 C# 中 我正在关注的一本书对设置和获取属性提出了这样的建议: double pri_test; public double Test { get { return pri_test; }
您可能熟悉 enum 位掩码方案,例如: enum Flags { FLAG1 = 0x1, FLAG2 = 0x2, FLAG3 = 0x4, FLAG4 = 0x8
在一些地方我看到了(String)value。在一些地方value.toString() 这两者有什么区别,在什么情况下我需要使用哪一个。 new Long(value) 和 (Long)value
有没有什么时候 var result = !value ? null : value[0]; 不会等同于 var result = value ? value[0] : null; 最佳答案 在此处将
我正在使用扫描仪检测设备。目前,我的条形码的值为 2345345 A1。因此,当我扫描到记事本或文本编辑器时,输出将类似于 2345345 A1,这是正确的条形码值。 问题是: 当我第一次将条形码扫描
我正在读取 C# 中的资源文件并将其转换为 JSON 字符串格式。现在我想将该 JSON 字符串的值转换为键。 例子, [ { "key": "CreateAccount", "text":
我有以下问题: 我有一个数据框,最多可能有 600 万行左右。此数据框中的一列包含某些 ID。 ID NaN NaN D1 D1 D1 NaN D1 D1 NaN NaN NaN NaN D2 NaN
import java.util.*; import java.lang.*; class Main { public static void main (String[] args) thr
我目前正在开发我的应用程序,使其设计基于 Holo 主题。在全局范围内我想做的是工作,但我对文件夹 values、values-v11 和 values-v14. 所以我知道: values 的目标是
我遇到了一个非常奇怪的问题。 我的公司为我们的各种 Assets 使用集中式用户注册网络服务。我们一般通过HttpURLConnection使用请求方法GET向Web服务发送请求,通过qs设置参数。这
查询: UPDATE nominees SET votes = ( SELECT votes FROM nominees WHERE ID =1 ) +1 错误: You can't specify
如果我运行一段代码: obj = {}; obj['number'] = 1; obj['expressionS'] = 'Sin(0.5 * c1)'; obj['c
我正在为我的应用创建一个带有 Twitter 帐户的登录页面。当我构建我的项目时会发生上述错误。 values/strings.xml @dimen/abc_text_size_medium
我在搜索引擎中使用以下 View : CREATE VIEW msr_joined_view AS SELECT table1.id AS msr_id, table1.msr_number, tab
为什么验证会返回此错误。如何解决? ul#navigation li#navigation-3 a.current Value Error : background-position Too
我有一个数据名如下 import pandas as pd d = { 'Name' : ['James', 'John', 'Peter', 'Thomas', 'Jacob', 'Andr
我是一名优秀的程序员,十分优秀!