mschart

How to show a message if chart data is empty?

橙三吉。 提交于 2019-12-24 14:27:51
问题 I have WinForm with chart and database.Chart get data from database. If no data the chart isn't visible. I would like to show a message in the chart place.For example: "No data yet." Can I do it? if (chart1["Series1"].Points.Count == 0) { ??? } 回答1: ..show a message in the chart..Can I do it? Sure. There are in fact many ways, from setting the chart's Title to using the Paint event and DrawString or creating a TextAnnotation etc.. The two latter options are easy to center and both will keep

How to draw vertical line on mschart that fills graph but isn't infinite?

偶尔善良 提交于 2019-12-24 11:57:18
问题 I am trying to draw a vertical line that is anchored to a point. I tried to use the height of my Y axis which is fixed to draw the line, but it wasn't centered correctly. So right now I have an infinite line, but that I want is the line to just fill the graph like so VerticalLineAnnotation lineannot = new VerticalLineAnnotation(); lineannot.AnchorDataPoint = chart.Series[item].Points.Last(); lineannot.LineColor = Color.Red; lineannot.Width = 3; lineannot.Visible = true; lineannot.IsInfinitive

using logarithmic scale in Ms chart control

限于喜欢 提交于 2019-12-24 11:34:07
问题 Im trying to create a chart the has a base 10 logarithmic scale for the x axis with a range from 1 to 1000. I seem to be able create the axis during design time but whenever the form is loaded I get an error message saying "Chart Area Axes - A logarithmic scale cannot be used for this axis. Is this a limitation on the MSChart control? why am I not able to create a log scale on the X Axis? 回答1: It is because for a logarithm scale, the values must be greater than zero. Charting.CHart treats

Finding series item clicked in a chart in VB 2008

瘦欲@ 提交于 2019-12-24 09:27:50
问题 I am using VB 2008 with the Microsoft Chart Controls for .NET Framework. Using a pie chart, I would like to find the selected item when the chart is clicked or double clicked. I am have the click and doubleclick events as shown here, which I have confirmed is being hit, and the the eventarts contains the x,y position of the click. Private Sub Chart_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Private Sub Chart_Click(ByVal sender As Object, ByVal e As System.EventArgs) What

Having issues with plotting Polar data on a DateTime X Axis

孤人 提交于 2019-12-24 08:35:24
问题 I'm trying to get some pretty simple polar plotting going here in a sandbox app and am getting some very strange results. Basically, I'm trying to recreate the answer to this question (eventually it gets a bit more complicated, but if I can do this, I should be on my way). Here's some code of how I'm setting it up. List<DateTime> xValues = new List<DateTime>(); List<double> yValues = new List<double>(); DateTime now = new DateTime(2012, 3, 20, 11, 24, 24); DateTime then = now.AddHours(2.0);

find the region part of live using c#

纵饮孤独 提交于 2019-12-24 05:56:43
问题 I have done like this for creating click event handler for one part of the chart using mschart control, the chart is like this and the code like this private void targetChartmouse_Click(object sender, MouseEventArgs e) { try { var pos = e.Location; var results = kpiChartControl.HitTest(pos.X, pos.Y, false, ChartElementType.DataPoint); foreach (var result in results) { if (result.ChartElementType == ChartElementType.DataPoint) { //do something.... } } } } It's working fine when we click on the

How to make StripLine appear over chart data points

孤街浪徒 提交于 2019-12-24 05:55:08
问题 I have a microsoft chart control and I use a StripLine . How do I make the StripLine appear in front of the data points. Currently the strip line is hidden behind some data. The chart is an area chart. 回答1: As far as I'm aware StripLine will always be drawn behind the data points. One way to fudge this howerver would be to use a PostPaint event handler and draw the rectangle yourself. inside the handler your can get drawing coordinates as follows private void chart_PostPaint(object sender,

C#: How To Crosshatch A Bar In An ASP.Net Bar Chart

寵の児 提交于 2019-12-24 02:16:51
问题 I have an asp.net bar chart that I'm trying to add cross hatching to one of the bars. I cannot figure out how to do it. I want to crosshatch the 4th bar (from the left) in the chart. I tried the following code below but it doesn't work. Chart1.Series["Actual"].Points[3].Color = ColorTranslator.FromHtml("#ffffff"); Chart1.Series["Actual"].Points[3].BorderColor = ColorTranslator.FromHtml("#d0d0d0"); Chart1.Series["Actual"].Points[3].BackSecondaryColor = ColorTranslator.FromHtml("#d0d0d0");

y axis start from 10 rather than 0 in mschart using windows application

折月煮酒 提交于 2019-12-23 21:22:28
问题 HI i want to start bar from 10 rather than 0. is it possible and how? chart1.ChartArea["ChartArea1"].AxisY.IsStartedfromZero=false chart1.ChartArea["ChartArea1"].AxisY.minimum=10 //but this line replace 0 another command to bar start from 10 in ms chart. 回答1: you are probably using the the wrong ChartType , what your code does is shift the baseline from Zero and instead start from 10 I presume what you really want is a Range Bar chart wherein you will have 2 values per bar representing the

MS chart radar axis frequency

我与影子孤独终老i 提交于 2019-12-23 12:09:24
问题 I'd like to draw a radar chart using MS Chart control in a WinForms app. This chart contains data for 1 day, I have data for every seconds, so I have 86 400 x-y value pairs. X axis contains dates, y my int values. My test code is like this: var fromDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0); var toDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59); List<DateTime> xValues = new List<DateTime>(); List<double>