找回密码
 立即注册

QQ登录

只需一步,快速开始

SAEUSER001
注册会员   /  发表于:2017-12-28 10:37  /   查看:6436  /  回复:14
你好,C1Chart闪点图Scatter,若X轴有多个点是日期相同的,为何没有合并?你们的demo中是有个scatter图的例子,但这里面的数据是随机的。请帮给个类似下图这样闪点图的例子。谢。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x

14 个回复

倒序浏览
JeffryLI
葡萄城公司职员   /  发表于:2017-12-28 13:41:47
沙发
您好,首先需要确定一下,您绑定X轴的字段的类型,确认下是否被当字符串处理了。希望能帮到您。
请点击评分,对我5分评价,谢谢!

葡萄城控件服务团队
官方网站: https://www.grapecity.com.cn/developer
回复 使用道具 举报
SAEUSER001
注册会员   /  发表于:2017-12-28 15:34:52
板凳
ChartDataSeries series ....省略代码
chart.ChartArea.AxisX.AnnoFormat=FormatEnum.DateManual;
chart.ChartArea.AxisX.AnnoFormatString = "MM-dd";
DateTime[] dates=new DateTime ....省略代码
double[] yValues=new double ....省略代码
series.X.CopyDataIn(dates);
series.Y.CopyDataIn(yValues);
请教,为何这样设置X轴不显示日期?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 使用道具 举报
JeffryLI
葡萄城公司职员   /  发表于:2017-12-28 16:58:49
地板
SAEUSER001 发表于 2017-12-28 15:34
ChartDataSeries series ....省略代码
chart.ChartArea.AxisX.AnnoFormat=FormatEnum.DateManual;
chart. ...

您好,看着像是没有绑到X轴上,能否提供您的Demo给我们,我们帮您看看。
请点击评分,对我5分评价,谢谢!

葡萄城控件服务团队
官方网站: https://www.grapecity.com.cn/developer
回复 使用道具 举报
SAEUSER001
注册会员   /  发表于:2017-12-29 08:51:44
5#
以下是窗体主体代码,请新建一个winform窗体,添加一个c1chart控件,并将以下核心代码复制过去就可以运行了:
   
public partial class frmMain : Form
    {
        private double[] y1, y2;
        private DateTime[] x;

        private void initialData()
        {
            x = new DateTime[32];
            x[0] = Convert.ToDateTime("2017-05-01");
            x[1] = Convert.ToDateTime("2017-05-01");
            x[2] = Convert.ToDateTime("2017-05-02");
            x[3] = Convert.ToDateTime("2017-05-03");
            x[4] = Convert.ToDateTime("2017-05-04");
            x[5] = Convert.ToDateTime("2017-05-05");
            x[6] = Convert.ToDateTime("2017-05-06");
            x[7] = Convert.ToDateTime("2017-05-06");
            x[8] = Convert.ToDateTime("2017-05-06");
            x[9] = Convert.ToDateTime("2017-05-06");
            x[10] = Convert.ToDateTime("2017-05-06");
            x[11] = Convert.ToDateTime("2017-05-06");
            x[12] = Convert.ToDateTime("2017-05-08");
            x[13] = Convert.ToDateTime("2017-05-08");
            x[14] = Convert.ToDateTime("2017-05-08");
            x[15] = Convert.ToDateTime("2017-05-08");
            x[16] = Convert.ToDateTime("2017-05-08");
            x[17] = Convert.ToDateTime("2017-05-09");
            x[18] = Convert.ToDateTime("2017-05-10");
            x[19] = Convert.ToDateTime("2017-05-10");
            x[20] = Convert.ToDateTime("2017-05-10");
            x[21] = Convert.ToDateTime("2017-05-11");
            x[22] = Convert.ToDateTime("2017-05-11");
            x[23] = Convert.ToDateTime("2017-05-18");
            x[24] = Convert.ToDateTime("2017-05-18");
            x[25] = Convert.ToDateTime("2017-05-18");
            x[26] = Convert.ToDateTime("2017-06-05");
            x[27] = Convert.ToDateTime("2017-06-07");
            x[28] = Convert.ToDateTime("2017-06-07");
            x[29] = Convert.ToDateTime("2017-06-07");
            x[30] = Convert.ToDateTime("2017-06-08");
            x[31] = Convert.ToDateTime("2017-09-06");

            y1 = new double[32];
            y1[0] = 0.0001
            ; y1[1] = 0.0
            ; y1[2] = 0.0001
            ; y1[3] = 0.0001
            ; y1[4] = 0.0
            ; y1[5] = 0.0
            ; y1[6] = 0.0
            ; y1[7] = 0.0001
            ; y1[8] = 0.0001
            ; y1[9] = 0.0002
            ; y1[10] = 0.0001
            ; y1[11] = 0.0002
            ; y1[12] = 0.0001
            ; y1[13] = 0.0
            ; y1[14] = 0.0
            ; y1[15] = 0.0001
            ; y1[16] = 0.0001
            ; y1[17] = 0.0001
            ; y1[18] = 0.0002
            ; y1[19] = 0.0001
            ; y1[20] = 0.0002
            ; y1[21] = 0.0001
            ; y1[22] = 0.0002
            ; y1[23] = 0.0002
            ; y1[24] = 0.0001
            ; y1[25] = 0.0001
            ; y1[26] = 0.0
            ; y1[27] = 0.0
            ; y1[28] = 0.0
            ; y1[29] = 0.0001
            ; y1[30] = 0.0001
            ; y1[31] = 0.0001;

            y2 = new double[32];
            y2[0] = 0.0
            ; y2[1] = 0.0
            ; y2[2] = 0.0
            ; y2[3] = 0.0
            ; y2[4] = 0.0
            ; y2[5] = 0.0001
            ; y2[6] = 0.0001
            ; y2[7] = 0.0
            ; y2[8] = 0.0
            ; y2[9] = 0.0
            ; y2[10] = 0.0
            ; y2[11] = 0.0
            ; y2[12] = 0.0
            ; y2[13] = 0.0
            ; y2[14] = 0.0
            ; y2[15] = 0.0
            ; y2[16] = 0.0
            ; y2[17] = 0.0
            ; y2[18] = 0.0
            ; y2[19] = 0.0
            ; y2[20] = 0.0
            ; y2[21] = 0.0
            ; y2[22] = 0.0
            ; y2[23] = 0.0
            ; y2[24] = 0.0
            ; y2[25] = 0.0
            ; y2[26] = 0.0
            ; y2[27] = 0.0
            ; y2[28] = 0.0
            ; y2[29] = 0.0
            ; y2[30] = 0.0
            ; y2[31] = 0.0;
        }
        private void initialChart()
        {
            ChartDataSeries series;
            ChartGroup cg=c1Chart1.ChartGroups.Group0;
            Area chartArea = c1Chart1.ChartArea;

            cg.ChartType = Chart2DTypeEnum.XYPlot;
            cg.Stacked = false;
            chartArea.AxisX.AnnoFormat = FormatEnum.DateManual;
            chartArea.AxisX.AnnoFormatString = "MM-dd";
            series = createSeries();
            cg.ChartData.SeriesList.Add(series);
            series.X.CopyDataIn(x);
            series.Y.CopyDataIn(y1);
            //
            series = createSeries();
            cg.ChartData.SeriesList.Add(series);
            series.X.CopyDataIn(x);
            series.Y.CopyDataIn(y2);
        }

        private ChartDataSeries createSeries()
        {
            return new ChartDataSeries();
        }

        public frmMain()
        {
            InitializeComponent();

            this.initialData();
            this.initialChart();
        }

    }
回复 使用道具 举报
SAEUSER001
注册会员   /  发表于:2017-12-29 08:53:39
6#

这样的图,不是闪点图吧。请帮修改以下,做个闪点图的例子。谢。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 使用道具 举报
JeffryLI
葡萄城公司职员   /  发表于:2017-12-29 10:19:04
7#
SAEUSER001 发表于 2017-12-29 08:53
这样的图,不是闪点图吧。请帮修改以下,做个闪点图的例子。谢。

您好,您的图表类型是不正确的,我看您的图表类型是Chart2DTypeEnum.XYPlot。这个不是散点图,
请点击评分,对我5分评价,谢谢!

葡萄城控件服务团队
官方网站: https://www.grapecity.com.cn/developer
回复 使用道具 举报
SAEUSER001
注册会员   /  发表于:2017-12-29 10:37:38
8#
你好,请把以上代码修改以下,做个demo,谢。
回复 使用道具 举报
SAEUSER001
注册会员   /  发表于:2017-12-29 10:40:14
9#
什么样的类型,才是闪点图?
    public enum Chart2DTypeEnum
    {
        // Summary:
        //     Plot chart type.
        XYPlot = 0,
        //
        // Summary:
        //     Pie chart type.
        Pie = 1,
        //
        // Summary:
        //     Bar chart type.
        Bar = 2,
        //
        // Summary:
        //     Area chart type.
        Area = 3,
        //
        // Summary:
        //     Polar chart type.
        Polar = 4,
        //
        // Summary:
        //     Radar chart type.
        Radar = 5,
        //
        // Summary:
        //     /// Bubble chart type.
        Bubble = 6,
        //
        // Summary:
        //     HiLo chart type.
        HiLo = 7,
        //
        // Summary:
        //     HiLoOpenClose chart type.
        HiLoOpenClose = 8,
        //
        // Summary:
        //     Candle chart type.
        Candle = 9,
        //
        // Summary:
        //     Gantt chart type.
        Gantt = 10,
        //
        // Summary:
        //     Step chart type.
        Step = 11,
        //
        // Summary:
        //     Histogram chart type.
        Histogram = 12,
    }
回复 使用道具 举报
JeffryLI
葡萄城公司职员   /  发表于:2017-12-29 12:09:56
10#
您好,关于散点图,\Documents\ComponentOne Samples\WinForms\C1Chart\CS\Scatter,请参考,希望能帮到您。
请点击评分,对我5分评价,谢谢!

葡萄城控件服务团队
官方网站: https://www.grapecity.com.cn/developer
回复 使用道具 举报
12下一页
您需要登录后才可以回帖 登录 | 立即注册
返回顶部