Home » Microsoft Technologies

Can I "Clip" a boxplot to chart area?

I've just started working with the chart control and have put together my first boxplot with multiple data series plotted by month for a 12-month range.  I've constrained the y-axis to make the chart more readable, but now I have a problem where the 25/75 box is being plotted outside the chart area.  Is there a way to clean this up?

I don't see a way to include an image here or I would have.

Thanks, Kevin




I want to set the x axis label text of a chart that shows multiple box plots - one for each series in the chart. The documentation says that this is done by setting each DataPoint's AxisLabel property.

Since the box plot is autogenerated from a databound binding source, I do this during the Customize event:

privatevoid boxPlotRawChart_Customize(object sender, EventArgs e)
 if (labelNames_ != null)
  for (int lab = 0; lab < labelNames_.Count; lab++)
    boxPlotRawChart.Series["BoxPlotSeries"].Points[lab].AxisLabel = labelNames_[lab].ToString();
    boxPlotRawChart.Series["BoxPlotSeries"].Points[lab].Color = Color.Red;

However, the axis labels do not change in any way, they keep displaying integers (0,1,2,3,4,5,6,7 - there are 6 box plots). The color change (second line inside the for loop) is executed and correctly displayed though. 

Is there any way to set text labels for an autogenerated box plot? (I am using Visual Studio 2008.)





I have 2 series chart types.

The first is an "Area" Chart Type

The second is a "Column" Type


I want have the Chart Area extend the entire width of the Chart. Is this possible to tell the series to extend to 0 and 100%?



VS2008 form designer can only add Line annotation.

I used the designer to put 2 charts on one form,  the coded the Text annotation, it works.

Then I used the designer to put 1 chart on the form, the chart has 2 chart areas, Text annotation does not show up. If I comment out

chart1.ChartAreas.RemoveAt(1); in the last line of the procedure below, myText annotation will show up in ChartArea[0].

Please help!

Thanks in advance.



      public OneChart2Area(string args)

            Series series1 = new Series();
            Series series2 = new Series();

            // Add data points to the first series
            series1.ChartType = SeriesChartType.Point;
            // y axis Major and minor tick mark
            chart1.ChartAreas[0].AxisY.MajorTickMark.Interval = 10;
            chart1.ChartAreas[0].AxisY.Maximum = 70;
            chart1.ChartAreas[0].AxisY.Minimum = 0;

            chart1.ChartAreas[0].AxisY.MinorTickMark.Enabled = true;
            chart1.ChartAreas[0].AxisY.MinorTickMark.Interval = 2;
            chart1.ChartAreas[0].AxisY.MinorTickMark.Size = 0.5F;

            //// add text annotation, does not work in multiple chart area, works in TrendChartForm.
            TextAnnotation myText = new TextAnnotation();
            myText.Text = "I am a TextAnnotation";
            myText.ForeColor = Color.Black;
            myText.Font = new Font("Arial", 12); ;
            myText.AnchorDataPoint = chart1.Series[0].Points[2];     // horizontal text. axis corrdinates
            myText.Alignment = ContentAlignment.TopCenter;



When I add charts and gauges to my reports they are always clipped. The bottom and right hand portions don't appear on the report. It appears they are being rendered too large. No matter how big I make the chart, gauge, report it gets clipped. However, if I export to PDF or Excel the full chart (didn't try the gauge) does appear. I have reproduced this IE8 and Firefox. I am running everything on a Windows 7 machine.


I am using chart control to create realtime step line chart using this code




Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load


Dim ChartArea1 As ChartArea = New ChartArea()


Dim Legend1 As Legend = New Legend()


Dim Series1 As Series = New Series()


Dim Chart1 = New Chart()



ChartArea1.Name =



Legend1.Name =



Chart1.Location =

New System.Drawing.Point(13, 13)

Chart1.Name =


Series1.ChartArea =


Series1.Legend =


Series1.Name =


Series1.ChartType = SeriesChartType.StepLine


Chart1.Size =

New System.Drawing.Size(800, 400)

Chart1.TabIndex = 0

Chart1.Text =



"Series1").XValueMember = "Trade Time"


"Series1").YValueMembers = "Trade rate"


"ChartArea1").AxisY.Minimum = 18700


"ChartArea1").AxisY.Maximum = 19000





Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick


cmd.Connection = con

srsql =

"select top 1 dtime,rate from MR order by dtime desc "

cmd.CommandText = srsql


Dim reader1 As SqlDataReader

reader1 = cmd.ExecuteReader


While reader1.Read()


IfNot reader1.GetValue(0) Is DBNull.Value Then lut = reader1.GetValue(0)


IfNot reader1.GetValue(1) Is DBNull.Value Then ltp = reader1.GetValue(1)





lbllut.Text = lut.ToString

TXTmr.Text = ltp.ToString


'ltp = ltp / 1000


If ltp <> preltp Then


"Series1").Points.AddXY(lut, ltp)



preltp = ltp




but the chart prepared through this code is showing y axis from 0 to 20000 but i want to set minimum and maximum values for y axis .

Kindly please help me.


Hi Experts.

I want to draw step area series chart using WPFtoolkit. In normal AreaSeries chart change value starts from some point before the original and creates a slope, I want step by step area series chart.

Any help?



Is it possible to fill back colour of the plotted area on a line graph? Thanks

Hi everybody,

I wan't to display multiple series (type column) in one chart area. Problem: the series are not displayed in the same order I added them to the chart. The x-values of the entire area are sorted (e.g. x-values of "series1" are mixed with x-values of "series2"). How can I prevent that behavior? I don't want that "series1" is mixed with "series2". The series should be displayed in one chartarea but seperated from each other (x-values only be sorted within a series). Any Ideas?

my code:

_selectQuery = "SELECT VerlaufStunde1, COUNT(VerlaufStunde1) AS 'VerlaufStunde1Anzahl' 
FROM ndc_Reflexionsbogen GROUP BY VerlaufStunde1 ORDER BY VerlaufStunde1Anzahl DESC"
; InitReader(_selectQuery); chartStundenverlauf.Series["series1" ].Points.DataBindXY(_sqlDataReader, "VerlaufStunde1" , _sqlDataReader, "VerlaufStunde1Anzahl" ); CloseReader(); _selectQuery = "SELECT VerlaufStunde2, COUNT(VerlaufStunde2) AS 'VerlaufStunde2Anzahl'
FROM ndc_Reflexionsbogen GROUP BY VerlaufStunde2 ORDER BY VerlaufStunde2Anzahl DESC"
; InitReader(_selectQuery); chartStundenverlauf.Series["series2" ].Points.DataBindXY(_sqlDataReader, "VerlaufStunde2" , _sqlDataReader, "VerlaufStunde2Anzahl" ); CloseReader();


I have 2 series of points that represent a range; one a maximum curve of where points should be and one a minimum curve of where points should be on the chart.  Currently I can add these as lines to the chart, make them gray and then plot several colored series ontop of them to see where values fall out of the range.

It would be nice to plot the min/max curves as an area chart and then plot lines ontop of it to easily see what falls outside of the range.  I can create an area chart for either the min or the max but it goes from zero to those values.  How can I plot an area chart to only show in a range; eg. across the x-axis, from 30 to 50, 22 to 42, etc.



I have a database and a view.

With MsExcel, I can create a Pivot Table and Chart as follow: http://screencast.com/t/Mjk4NDQ0Zm

I'm trying to do the same in .NET MVC but I'm struggling.

Any example, tutorial, ... would be more than helpful.




I need to have multiple X-cursors in single chart area for measurement purpose.  Since this is not possible, I've created a line custom control and added it into the chart like 


But how to position the control within the chart area(just like default cursor )? Also How to get corresponding X and Y values for each series when the control position changes?

Thanks in advance


Hi all forum

  I am having some little problem with my asp.net chart control. I am using vs 2010 with framework4. I am binding my chart to a data table. axis x is binding to date and y axis binding to price When I use column chart I get very beautiful result. but when i use the spline area I got some different shape which fills all the area of the Chart not only the series. I think that that there is a certain option in the spline chart area that let me bind to one series only and give same data as the column chart type.


Wishing for your advise


I need to put two bar charts side-by-side so the chart areas align.  But when the bar counts get large, the labels on the horizontal (y) axis stagger.  This staggering makes the chart area on that chart smaller than the other chart; so they don't align anymore.  Is there a way to force alignment of these chart areas or to stop the labels from staggering?  Is there a setting for this in the rdlc file? 

I am using reportviewer in .NET 2008 and programmically filling out out datasets to populate the data. 

Thanks for your help.



I'm using Chart Controls (.Net 4.0) and an ActiveX object from Melexis (MLX90316PSFModule). When I create a Melexis device and a Chart object in the same application it throws a Stack Overflow error. The application consist of a single Form with a Chart on it, and the Melexis device gets created on the Form_Load event.

I also tried programmatically creating and adding my Chart to the form with same result. Depending on which object I create secondly will cause stack overflow. No infinite loops or recursive calls in my program. Individually both objects work perfectly for me.

How can I investigate which object causing this?

So far I have managed to reproduce the same error on VB 2008, VB2010, VC2008, VC2010, on three different PCs with XP, Vista and 7(all 32bit).

Also I used the editbin.exe/stack to increase the stack size tenfold,  but with same result.

What would you try next? (no source code for the Melexis ActiveX unfortunately)

Thanks in advance!



i have a chart where i have multiple chart areas. if i let the chart areas auto position themselves they all become of the same height. but i need the chart areas to have different height. like either by mentioning fixed height or a percentage of the total height of the chart.


how can i do this without positioning all the chart areas manually?



I am using WPFToolkit Charting Control for the Column Chart, But in that Plot area is very small area (White colored) and the Border (Blue Colored) is very big, so i want to increase plot area and decerase chart area border, how to do that...


Sample code is shared on below link


Vipul Mistry


When creating chart with axis X interval set to 1, in some cases, the chart is not spread to all posible place, but there is blank space on the right of graph area.

I tried to use chartarea.position.width but without any success.

Is there a way to fill chart all over the place, but with respect to legend, etc..

Thanks for any help


I have a chart containing around 10 BoxPlot series, each representing a distribution of data collected in different years. The boxplot series show correctly but do not know how to specify the placement of the series along the X-Axis. At the moment the boxplots appear side by side with no space between them and with an X-axis scale that seems related to the PointSize property. I would like the X-Axis placement to be determined by the Year, or by a specific date value.

I construct the graph at run-time using this approach:

Loop over all years
     Add Series to hold data values for this year
     Add Series to hold BoxPlot for this year
Note: I set up the series properties for the boxplot and set the BoxPlot's DataSeries property so that it refers to the correct data series
next year

Then I add the data:

Loop over all years

    Year = current year

    Loop over all data in this year
       Value = data value in current year
       DataSeriesName = Year.tostring   (eg "2009")
   next datapoint

next year

Any help will be greatly appreciated!


Hi All,

I have the following questions.

1. Is a window's client area including the areas occupied by the vertical scrollbar and horizontal scrollbar?

As what i observed, it seems true, but i am not sure.

2. If the answer of the the previous question is true, then how to get the client area excludes the areas occupied by the vertical scrollbar and horizontal scrollbar?

thanks in advance!

how to hidden or disabled the application area button and Sub Area elements  from users based on security privileges ?


<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure