C#界面编程,现在数据库里有成千上万个点的坐标,想利用这些坐标绘制曲线,望高手给点意见

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C#界面编程,现在数据库里有成千上万个点的坐标,想利用这些坐标绘制曲线,望高手给点意见相关的知识,希望对你有一定的参考价值。

用第三方控件还是直接编程实现,现在我用的是zedgraph,但是感觉画成千上万个点还是有点吃力的

不要尝试同时画出上万个点,做成可缩放的形式。全景时通过计算提取出n个点。局部放大时显示所有点。
就象地图一样。显示全国时乡道就不要显示了。追问

你好,能具体问问你吗?希望能给回复

追答

我的想法是这样的。比如你有3000个点需要显示,在客户端显示全部的时候可以考虑只显示1000个点或是更少。比如这些点是连续平均分布的,那么可以每个点按1、2、3排序,只显示1的点,去掉2、3的点。或是将1、2、3计算一个平均值,那么,你只需要考虑显示1000个点了。
然后在程序界面中加入放大缩小功能。放大时就只要显示局部就可以了,而局部图可能全部显示可能也只有1000个点。那么显示上面的压力就减少了2/3了。

还有一种解决方案是如果没有特别要求的话,可以将你的坐标图转为图片文件进行显示,这样可以在第一次加载时计算出图像文件,后面显示起来就不吃力了。

参考技术A 用FLASH 参考技术B C# 里面有个 danamic data(动态 绘图)的 library ,你搜索一下看看 参考技术C 第三方控件 参考技术D wpf 第5个回答  2012-12-04 zedgraph加多线程。

c#笔记(十七)——队列

《第十二讲:C#语言编程》集合
 
课后题:
1. (*)用集合保存4个人的随机投票,列出最终票数及各自的名字
 
2. (* *)在一个有限平面区域上(1000 * 1000)随机生成有序的n个点(用结构体表示点),将其保存在集合中
  (1)输出所有点的坐标信息
  (2)计算有序相邻两点距离之和(先排序,再求距离)
 
 
3. (* * *)队列:仿照模拟经营类游戏中的情形,自定义一个窗口类,实例化一个窗口,一共有10位顾客,每位顾客接受服务的时间为2~3分钟,求15分钟后仍为接受服务的顾客名单。
 
using System;
//非范型集合所在的命名空间
using System.Collections;
//范型集合命名空间
using System.Collections.Generic;
 
namespace Lesson12
{
                 public class PrintTool{
                                 //专门输出队列的元素
                                 public void PrintStack(Stack a){
                                                 foreach (var item in a) {
                                                                 Console.Write (item+"  " );
                                                }
                                }
 
                                 public void PrintQueue(Queue< string> q){
                                                 foreach (var item in q) {
                                                                 Console.Write (item+"  " );
                                                }
                                                 Console.WriteLine ();
                                }
                }
 
                 class MainClass
                {
                                 public static void Main ( string[] args)
                                {
                                                 //集合:把一些能够确定的不同的对象看成一个整体,
                                                 //                就说这个整体是由这些对象的全体构成的集合.
                                                 //元素:集合中每个对象叫做这个集合的元素.
                                                 PrintTool zhangsan = new PrintTool ();
                                                 Stack stack = new Stack ();
                                                 //Push:往集合里放一个东西
                                                stack.Push (1);
                                                stack.Push (5.4f);
                                                stack.Push ("你好~!" );
 
                                                 //可以用foreach访问Stack集合里的元素
                                                zhangsan.PrintStack (stack);
 
                                                 //Pop:返回并移除集合顶部的对象
                                                 object propItem = stack.Pop ();
                                                 Console.WriteLine (propItem);
 
                                                 //可以用foreach访问Stack集合里的元素
                                                zhangsan.PrintStack (stack);
                                                 object peekItem = stack.Peek ();
 
 
                                                 //赋值语句,条件语句
                                                 //stack.Clear ();
                                                 Queue<string > queue = new Queue< string> ();
                                                queue.Enqueue ("张三" );
                                                queue.Enqueue ("李四" );
                                                queue.Enqueue ("王二" );
                                                queue.Enqueue ("麻子" );
                                                queue.Enqueue ("老王" );
                                                zhangsan.PrintQueue (queue);
                                                 //返回队列的第一个元素,并将这个元素从集合中删除
                                                 string dequeueItem = queue.Dequeue ();
                                                 Console.WriteLine (dequeueItem);
                                                zhangsan.PrintQueue (queue);
                                                 //
                                                 //Dictionary:字典集合
                                                 Dictionary<int ,string> students =
                                                                 new Dictionary <int, string> ();
                                                 //往字典里存放值,key是唯一的,不能重复添加key
                                                students.Add (1, "李逵" );
                                                students.Add (2, "张飞" );
                                                students.Add (3, "宋江" );
                                                students.Add (4, "关羽" );
 
                                                 //用foreach迭代集合中的元素
                                                 foreach (var item in students) {
                                                                 Console.WriteLine (item.Value);
                                                }
                                                 //元素的访问:变量名称[key(键)]形式来访问单个value元素
                                                 Console.WriteLine (students [1]);
                                                 //在直接通过索引方式去值的时候,
                                                 //要注意key在存在情况下才能去成功否则或报错
                                                 if (students.ContainsKey (5)) {
                                                                 Console.WriteLine (students [5]);
                                                } else {
                                                                 Console.WriteLine ("key不存在" );
                                                }
 
                                                 string value;
                                                 bool isGet = students.TryGetValue (5, out value);
                                                 Console.WriteLine (isGet + "  " + value);
 
                                                 //移除键以及键所对应的元素
                                                students.Remove (1);
                                                 //用foreach迭代集合中的元素
                                                 foreach (var item in students) {
                                                                 Console.WriteLine (item);
                                                }
                                                 //判断是否存在指定的值
                                                 Console.WriteLine (students.ContainsValue ("张飞"));
 
                                                 //取得集合中的所有键
                                                 Dictionary<int ,string>. KeyCollection keys = students.Keys;
                                                 foreach (var item in keys) {
                                                                 Console.WriteLine (item);
                                                }
 
                                                 // “张三 ,2”
                                    // "李四 ,5"
                                                 // “wanger , 3”
//                                             Dictionary<string,int> voite = new Dictionary<string, int> ();
//                                             for (int i = 0; i < 10; i++) {
//                                                             string name = Console.ReadLine ();
//                                                             if (!voite.ContainsKey (name)) {
//                                                                             voite.Add (name, 1);
//                                                             } else {
//                                                                             voite [name] += 1;
//                                                             }
//                                             }
//
//                                             foreach (var item in voite) {
//                                                             Console.WriteLine (item);
//                                             }
 
                                                 //List<T> 动态数组
                                                 List<int > scores = new List< int> ();
                                                scores.Add (1);
                                                scores.Add (2);
                                                scores.Add (3);
                                                scores.Add (4);
                                                scores.Add (5);
 
                                                 //Insert,从指定的索引位置插入元素
                                                scores.Insert (3, 6);
                                
                                                 //Remove:删除指定元素
                                                scores.Remove (6);
 
                                                 //RemoveAt:删除指定索引位置的元素
 
                                                 //Reverse:
                                                scores.Reverse ();
                                                 //
                                                scores.Sort ();
                                                 foreach (var item in scores) {
                                                                 Console.WriteLine (item);
                                                }
 
 
                                }
                }
}

以上是关于C#界面编程,现在数据库里有成千上万个点的坐标,想利用这些坐标绘制曲线,望高手给点意见的主要内容,如果未能解决你的问题,请参考以下文章

关于android软件编程中如何画函数折线图的问题

C语言程序,输入N个点的坐标,判断能否构成凸多边形

坐标轴上所有点的坐标用c语言怎么求

网易2017校招编程:优雅的点(PHP版本)

网易2017校招编程:优雅的点(PHP版本)

网易2017校招编程:优雅的点(PHP版本)