我想用动态图表制作ZedGraph:
如何使ZedGraph轴反转和时间轴?谢谢
UPD 1:我必须尝试使用以下代码:
GraphPane myPane = zg1.GraphPane;
myPane.YAxis.Type = AxisType.Date;
myPane.YAxis.Scale.MajorUnit = DateUnit.Minute;
myPane.YAxis.Scale.MinorUnit = DateUnit.Second;
myPane.XAxis.IsVisible = false;
myPane.X2Axis.IsVisible = true;
myPane.X2Axis.MajorGrid.IsVisible = true;
myPane.X2Axis.Scale.Min = 0;
myPane.X2Axis.Scale.Max = 600;
myPane.YAxis.Scale.Format = "HH:mm:ss";
PointPairList list = new PointPairList();
PointPairList list2 = new PointPairList();
for (int i = 0; i < 36; i++)
{
double x = (double)i * 5.0;
double y = (double)new XDate(DateTime.Now.AddSeconds(i));
list.Add(y, x);
//list2.Add(y2, x);
listBox1.Items.Add("x = " + x + " y = …Run Code Online (Sandbox Code Playgroud) 在VS 2010 SP 1中,我为.Net Framework 2创建了WinForms应用程序。我尝试从资源中获取图标并将其分配给表单图标:
this.Icon = global::tester.Properties.Resources.icon_gray;
Run Code Online (Sandbox Code Playgroud)
图标资源icon_gray.ico已从VS设计器添加到我的开发人员PC Windows 7 x86(带有.NET Framework 3.5 SP1和.NET 4)中的Resources.resx中。
但是在以下错误 Windows XP SP 3 with only .NET Framework 2 SP 2
错误:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ComponentModel.Win32Exception: ???????? ????? ???????
at System.Drawing.Icon.Initialize(Int32 width, Int32 height)
at System.Drawing.Icon..ctor(SerializationInfo info, StreamingContext context)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._SerializationInvoke(Object target, SignatureStruct& declaringTypeSig, SerializationInfo info, StreamingContext context)
at System.Reflection.RuntimeConstructorInfo.SerializationInvoke(Object target, SerializationInfo info, StreamingContext …Run Code Online (Sandbox Code Playgroud) 我有 SQL Server 表:
CREATE TABLE [dbo].[Table1](
[rec_id] [int] IDENTITY(1,1) NOT NULL,
[id] [int] NOT NULL,
[date] [datetime] NOT NULL,
[ps] [varchar](200) NULL
) ON [PRIMARY]
Run Code Online (Sandbox Code Playgroud)
我通过代码获取数据:
status = SQLExecDirect(statement, (SQLWCHAR*)TEXT("SELECT * FROM [DBNAME].[dbo].[Table1]"), SQL_NTS);
cout << "SQLExecDirect returned " << status << "\r\n";
if (status == SQL_SUCCESS_WITH_INFO || status == SQL_SUCCESS)
{
int rec_id;
int id;
char date[64];
char ps[201] = { 0 };
while (SQLFetch(statement) == SQL_SUCCESS)
{
SQLGetData(statement, 1, SQL_C_ULONG, &rec_id, 0, NULL);
SQLGetData(statement, 2, SQL_C_ULONG, &id, …Run Code Online (Sandbox Code Playgroud) 我用OPC服务器编写XML AJAX服务。基于此示例的XML AJAX服务。我使用单一属性进行服务:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
Run Code Online (Sandbox Code Playgroud)
下一步,我创建类析构函数:
~BoilerService()
{
try
{
ReadTimer.Dispose();
group.ReadCompleted -= new ReadCompleteEventHandler(group_ReadCompleted);
group.Remove(true);
server.Disconnect();
}
catch (Exception e)
{
System.IO.StreamWriter sw = new System.IO.StreamWriter("log.txt", true);
sw.WriteLine(DateTime.Now.ToString() +e.Message+ " "+ e.Source+" "+e.StackTrace + " destructor called.");
sw.Close();
sw.Dispose();
}
}
Run Code Online (Sandbox Code Playgroud)
但是,当我在VS中重建解决方案时(在应用程序路径中替换了文件),我得到了wp3.exe未处理的异常错误窗口(Windows 7)。在Windows事件日志中,我看到以下文字:
Exception: System.Runtime.InteropServices.InvalidComObjectException
Message: COM object that has been separated from its underlying RCW cannot be used.
StackTrace: at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, Boolean& pfNeedsRelease)
at OPC.Data.Interface.IOPCServer.RemoveGroup(Int32 hServerGroup, Boolean bForce)
at OPC.Data.OpcGroup.Remove(Boolean bForce)
at …Run Code Online (Sandbox Code Playgroud) 我使用 Microsoft InteractiveDataDisplay.WPF(以前的 DynamicDataDisplay)来可视化实时数据(大约 2-3 秒)。此代码 xaml.cs:
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
double[] y = new double[200];
double[] x = new double[200];
for (int i = 0; i < 200; i++)
{
y[i] = 3.1415 * i / (y.Length - 1);
x[i] = DateTime.Now.AddMinutes(-i).ToOADate();
}
linegraph.Plot(x, y);
}
}
Run Code Online (Sandbox Code Playgroud)
使用这个 xaml:
<d3:Chart Name="plotter">
<d3:Chart.Title>
<TextBlock HorizontalAlignment="Center" FontSize="18" Margin="0,5,0,5">chart sample</TextBlock>
</d3:Chart.Title>
<d3:LineGraph x:Name="linegraph" Description="Simple linegraph" Stroke="Blue" StrokeThickness="3">
</d3:LineGraph>
</d3:Chart>
Run Code Online (Sandbox Code Playgroud)
任何想法如何做到这一点?谢谢!
更新 1(使用 …