I have created multiple Y-axis in chart and individual scales for each axis by default. Now if user(i) wants to change those default values. I have created one form with textbox for entering scale min and max values.
I have attached an image please have a loot at the image.
now i want to get that text box value and assign to min and max scale of each axis.
Can anyone have the idea how to do it . please help me.
You can modify axis scales using SetMinMax method, for example:
tChart1.Axes.Custom[0].SetMinMax(min, max);
For more information about axis settins please read tutorial 4. Tutorials can be found at TeeChart's program group. For multiple custom axis you may be interested in reading this question.
Related
I am currently working with visifire on a c# charting project.
I want to create a bar chart to show percental increase as green bars and decreases as red bars. The Axis / 0 point line should always remain at the same position.
The problem is, that the axis currently moves all around the screen depending on the values that are shown. (see the image below)
I already tried to center it with axismaximum and axisminimum set to fix values, but that doesn't work.
The way i want it to be is like this.
or this
Are there any remaining visifire cracks out there, that can understand the problem and help?
One workaround for this is finding the maximum value (absolute value, using Math.Abs) from the series, then adding its counter value to the beginning of series.
For example, if the maximum absolute value is -80%, then add a +80%. In this way, the axis can be centred.
You can use a special colour (Transparent?) for the first bar, or use other control to cover it so user will only see the real data.
Using data bindings, this should do the trick.
MinValue = -MaxValue
<vc:Chart.AxesY >
<vc:Axis AxisMaximum="{Binding MinValue}" AxisMinimum="{Binding MaxValue}" Enabled="False" AxisType="Primary" >
</vc:Axis>
</vc:Chart.AxesY>
Otherwise this is the same without databinding
<vc:Chart.AxesY >
<vc:Axis AxisMaximum="70" AxisMinimum="-70" Enabled="False" AxisType="Primary" >
</vc:Axis>
</vc:Chart.AxesY>
I have a chart that has times on X axes. How can I remove the gaps in between the points on the X axes? I think that it might be called interval or scale or something but I'm not sure where in the properties I can find it.
I assume that you are using Microsoft Chart controls and you are trying to fit the "time" labels within the XAxis length.
You can set the LabeAutoFitStyle property of the ChartArea's XAxis as fitted for your requirement. See this MSDN link for different LabelAutoFitStyles.
chart1.ChartAreas[ChartName].AxisX.LabelAutoFitStyle = LabelAutoFitStyles.LabelsAngleStep45;
If you want to change the intervals and number of intervals used in display, use AxisX.Interval and AxisX.IntervalAutoMode property.
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?
It is because for a logarithm scale, the values must be greater than zero. Charting.CHart treats empty chart as being consisting of zeros (I know it is weird). This error can be very difficulty to debug. Therefore, it mean that the graph cannot be EMPTY if any of the axis is a logarithm scale. What I normally do is set the axis as linear and the change it immediately after plot on the graph (and checking no zeros or negative values on the logarithm scale). Also, remember to change the axis to linear before clearing the axis and plotting. Hope this helps someone.
I propose to use SuppressExceptions property which allows to ignore some exceptions, also that one connected with zeros in axis with logarithmic scale. I think this is the best solution for that situation instead manipulating data.
chart.SuppressExceptions = true;
It's not just about zeroes but also about having your values in the right datatype. Suppose you're populating the chart with values form a DataTable. If you haven't specified the type, .NET will automatically assume they are strings and thus not be able to plot a logarithmic scale.
incomplete specification of the datatable:
PP = New DataTable
PP.Columns.Add("X-value")
PP.Columns.Add("Y-value")
complete specification:
PP = New DataTable
PP.Columns.Add("X-value", Type.GetType("System.Double"))
PP.Columns.Add("Y-value", Type.GetType("System.Double"))
In the first example the exception will be thrown. In the second it won't.
Not all chart types support logarithmic scales; try changing the chart type e.g. to Line Chart.
Chart types: http://msdn.microsoft.com/en-us/library/dd489233.aspx
ChartType property: http://msdn.microsoft.com/en-us/library/system.windows.forms.datavisualization.charting.series.charttype.aspx
I am currently using Microsoft Chart Controls to generate a box plot chart. I have enabled the IsValueShownAsLabel property of the chart's series, but only the first y-value(lower whisker) value is being labeled. Is there a way to enable the labeling of all y-values in the chart?
Also, is there a way to get a different axis for each data point? The different data points of the chart are not related when it comes to value ranges, so many data points with small y-values are difficult to read on the chart. I have currently enabled scrolling as a workaround, but am not satisfied with the result. I would instead like to have a different y-axis for each data point, so that the y-values for each data point take up the full height of the chart, with the min and max whisker values serving as the y-axis minimum and maximum points. Is this possible?
To get different axis you will need to look into the properties under ScaleBreakStyle under AxisY
Set something like
Chart1.ChartAreas[0].AxisY.ScaleBreakStyle.Enabled = true;
Chart1.ChartAreas[0].AxisY.ScaleBreakStyle.BreakLineStyle = Charting.BreakLineStyle.Wave;
// set this to an even lower value if required
Chart1.ChartAreas[0].AxisY.ScaleBreakStyle.CollapsibleSpaceThreshold = 15;
Not sure on how to get multiple values but can you try setting those values specifically to the labels in these format #VALY1,#VALY2 depending on the number of Y values available.
I'm using the Visiblox WPF API and am having trouble getting the chart points in my line chart to scroll horizontally. Instead of scrolling, the points are get squashed together, in which, this isn't particularly a problem, except that I expect to have 100s of data points on the chart. I have looked throughout the examples available on the Visiblox website, but couldn't find what I was looking for. Ive attached an example screenshot.
Any ideas?
Thanks for your help,
Sparky
By default Visiblox Charts will re-calculate the range to include all the data in the series, so there are two possible approaches: 1) when you add the last point, remove the first one which will effectively move the visible window one point over or 2) set an explicit axis range and update that when you want to move the visible window.
Check out the Visiblox blog for more details on how ranges work at: http://www.visiblox.com/blog/2011/03/visiblox-charts-ranges-demystified
I just had something like this recently. Everytime I'd add a point to the cart I'd run a little section of code that would check the amount of time (my x-axis dimension) that had passed since 0. I also set up a range of data I always wanted to see. I always wanted to show 120 seconds of data on the graph. So I had something like this:
private void adjustXasis(int timeCount)
{
if(timeCount>desiredRange)
{
chart.axis.Xaxis.minimum=timeCount-desiredRange;
chart.axis.Xaxis.maximum=timeCount;
}
else //two minutes not reached yet
{
chart.axis.Xaxis.minimum=0;
chart.axis.Xaxis.maximum=desiredRange;
}
}
I don't have VS in front of me and I know that syntax for the axis min/max is wrong but you get the idea.
By default Visiblox Charts will re-calculate the range to include all the data in the series, so there are two possible approaches:
1) when you add the last point, remove the first one which will effectively move the visible window one point over or
2) set an explicit axis range and update that when you want to move the visible window.
Check out the Visiblox blog for more details on how ranges work at: http://www.visiblox.com/blog/2011/03/visiblox-charts-ranges-demystified