在Microsoft图表控件大胆点 [英] Bold points in Microsoft Chart control

查看:117
本文介绍了在Microsoft图表控件大胆点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用我的Web表单Microsoft图表控制。我想点(0,0)应在图表上粗体。我的code是如下:

  DataTable的DT = collection.ToDataTable();
        // Chart1.Series [0] .Points.DataBind(收集,价格,OverallQuality,标签= HotelName);        的for(int i = 0; I< dt.Rows.Count;我++)
        {            Chart1.Series.Add(系列+ I);
            Chart1.Series [系列+ i] = .ChartType SeriesChartType.Point;
         // Chart1.Series [系列+ I] .Points.AddXY(double.Parse(dt.Rows [I] [价格]。的ToString()),double.Parse(dt.Rows [I] [ OverallQuality]的ToString()))。
            Chart1.Series [系列+ I] .Points.AddXY(double.Parse(dt.Rows [I] [OverallQuality]。的ToString()),double.Parse(dt.Rows [I] [价格 ]的ToString()));            Chart1.Series [系列+ I] .MarkerSize = 10;
            Chart1.Series [系列+ i] = .LegendText dt.Rows [I] [HotelName]的ToString()。
        }
     // Chart1.ChartAreas [0] .AxisX.Title =价格;
     // Chart1.ChartAreas [0] .AxisY.Title =质量;
        Chart1.ChartAreas [0] .AxisX.Title =质量;
           Chart1.ChartAreas [0] .AxisY.Title =价格;        Chart1.ChartAreas [0] .AxisX.Maximum = 10;
        Chart1.ChartAreas [0] .AxisX.Minimum = -10;
        Chart1.ChartAreas [0] .AxisX.Interval = 1;        Chart1.ChartAreas [0] .AxisY.Maximum = 10;
        Chart1.ChartAreas [0] .AxisY.Minimum = -10;
        Chart1.ChartAreas [0] .AxisY.Interval = 1;        Chart1.ChartAreas [0] .AxisX.MajorGrid.LineColor = System.Drawing.Color.LightGray;
        Chart1.ChartAreas [0] .AxisY.MajorGrid.LineColor = System.Drawing.Color.LightGray;
    }


解决方案

你有没有试图改变系列PointWidth?

  Chart1.Series [系列] [PointWidth] =0.2;

您可以找到一堆操纵这个属性,比如T的。但诀窍,您的具体情况,正在处理的事实,你只能操纵该属性为整个系列。 后使我相信你也会有问题将其设置为仅此特定点,除非你能分开是到它自己的莫名其妙。 <一href=\"http://stackoverflow.com/questions/2137157/force-a-gap-between-points-on-the-x-axis-ms-net-chart-controls-column-chart\">Here's从堆栈有点类似,可以帮助,根据您的信息是如何被格式化的exmample。

I'm using microsoft Chart control in my web form. I want points(0, 0) should be bold on the chart. My code is as follows:

 DataTable dt = collection.ToDataTable();
        //   Chart1.Series[0].Points.DataBind(collection, "Price", "OverallQuality", "Label=HotelName");

        for (int i = 0; i < dt.Rows.Count; i++)
        {

            Chart1.Series.Add("series" + i);
            Chart1.Series["series" + i].ChartType = SeriesChartType.Point;
         //   Chart1.Series["series" + i].Points.AddXY(double.Parse(dt.Rows[i]["Price"].ToString()), double.Parse(dt.Rows[i]["OverallQuality"].ToString()));
            Chart1.Series["series" + i].Points.AddXY(double.Parse(dt.Rows[i]["OverallQuality"].ToString()), double.Parse(dt.Rows[i]["Price"].ToString()));

            Chart1.Series["series" + i].MarkerSize = 10;
            Chart1.Series["series" + i].LegendText = dt.Rows[i]["HotelName"].ToString();
        }
     //   Chart1.ChartAreas[0].AxisX.Title = "Price";
     //   Chart1.ChartAreas[0].AxisY.Title = "Quality";
        Chart1.ChartAreas[0].AxisX.Title = "Quality";
           Chart1.ChartAreas[0].AxisY.Title = "Price";

        Chart1.ChartAreas[0].AxisX.Maximum = 10;
        Chart1.ChartAreas[0].AxisX.Minimum = -10;
        Chart1.ChartAreas[0].AxisX.Interval = 1;

        Chart1.ChartAreas[0].AxisY.Maximum = 10;
        Chart1.ChartAreas[0].AxisY.Minimum = -10;
        Chart1.ChartAreas[0].AxisY.Interval = 1;

        Chart1.ChartAreas[0].AxisX.MajorGrid.LineColor = System.Drawing.Color.LightGray;
        Chart1.ChartAreas[0].AxisY.MajorGrid.LineColor = System.Drawing.Color.LightGray;
    }

解决方案

Have you tried changing the PointWidth of the series?

Chart1.Series["series"]["PointWidth"] = "0.2"; 

You can find a bunch of examples of manipulating this property, such as this. But the trick, for your situation, is dealing with the fact that you can only manipulate this property for the entire series. This post leads me to believe you will have problems setting it for just this particular point, unless you can separate is into it's own somehow. Here's an exmample from stack somewhat similar that might help, depending on how your information is formatted.

这篇关于在Microsoft图表控件大胆点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆