asp.net chart: final series getting cut off when setting .AxisX.Maximum - asp.net

I'm trying to bind a data table like,
month value
5 345
10 1300
12 450
to an ASP.NET Chart control. My problem is that the data table only contain months that have values while in the chart i want to show the full month range from 1st to the 12th.
So i used
Chart1.ChartAreas["ChartArea1"].AxisX.Minimum = 1;
Chart1.ChartAreas["ChartArea1"].AxisX.Maximum = 12;
But when i do this, a part of the final series gets cut off in the middle like this.
I can avoid this issue by making the maximum 13 but that would not be appropriate since i just need to show the months of the year. Please help.

Yes but look at how the x-axis is measured; it is not just 12, then 13. It is 12.2, 12.4, 12.6, 12.8 and then 13.0. So you see if you make 12.0 the maximum you are not going to get the entire bar for the final month. Also your x-axis shouldn't even be on that interval in the 1st place. It should be in whole numbers only since you are measuring months.
An example of using the "Interval" property on an Axis in a bar chart:
<axisx Title="MyValue" Interval="1" IsMarginVisible="false">
I use ASP.NET charts a lot, and the best site is the one below. I highly recommend downloading the FULL .NET project and look at the samples and code. These types of bar charts are trivial, as you will see after looking at some of the examples in the .aspx sample pages.
Samples Environment for Microsoft Chart Controls:
http://code.msdn.microsoft.com/mschart/Release/ProjectReleases.aspx?ReleaseId=4418

this is about aligning the series position and controlling the width of series
check links
http://asp-net-example.blogspot.com/2010/09/how-to-use-chart-backimagealignment.html
MS Chart with ASP.NET chart type "column" not showing axis x label if there are more than 9 bar in the chart
http://forums.asp.net/p/1516836/3636476.aspx
also generally useful
http://betterdashboards.wordpress.com/2009/02/11/align-multiple-chart-areas/
http://www.ezzylearning.com/tutorial.aspx?tid=4337488

Related

How to plot only within a range defined by x number of bars?

I understand that I can contingently plot on the chart using range of date and time values.
However, I would like to be able to plot using a specific number of candlesticks.
For example, I would like to be able to say something like
// Within the most recent 10 bars
// If close[0] > close[1]
// plotshape()
I have tried implementing numerous variations using barstate.isrealtime or barstate.islast but I keep running into limitations.
One major problem is that, although bar_index[#] works by indexing backwards from the most recent bar, the value of bar_index[10] is not 10 but some number in the thousands (depending on the timeframe of the chart — for me its Daily = 2,616 candles, 1hr = 6,217 candles, 15m = 5,222, etc.). In other words, it counts the number of bars from the oldest bar available.
Since referencing of the bars (starting from most recent) and the index values (starting from the oldest) are conflicting--due to counting from opposite ends--I am not sure how to specify: plotshape() for the most recent 10 bars.
I am also running into trouble due to the fact that bar_index[0] occurs every single iteration of the chart's timeframe--so I am getting caught in recursive calculations when trying to do bar_index[0]-bar_index[10].
It seems that what I need is something like bar_index.islast[10]
The reason that I would like to call a plotshape() based on the number of specified candles versus since x date/time (or within date range (x,y)), is because I want my indicator to function properly regardless of which timeframe my chart is displaying:
If I am showing a monthly chart, I want to plot across the last 10 monthly bars; If I am showing a daily chart, I want to plot across the last 10 daily bars; etc.
If I am forced to use a date range, then this functionality breaks down, since I will be shown increasingly more bars for smaller timeframes.
Caveat**
I am able to kinda make this work by specifying the number of bars from the oldest candlestick by stating something like:
bar_index > 2600 ? color=color.black : na
However, given the fact that every single time frame displays a different number of bars, this is not a workable solution for me.
Thanks for any advice.
UPDATE
I have been hunting around and and found that the functionality I desire is already built into the show_last argument of the various plot()functoins.
Ill leave my question posted, in case it helps someone else.
UPDATE I have been hunting around and and found that the functionality I desire is already built into the show_last = int argument of the various plot() functions.
I'll leave my question posted, in case it helps someone else.

Google image-charts x-axis lable not responding to the chxl attribute

I am trying to implement a chart into my website using image-charts, but no matter how I set the x-axis, the labels never works out the way I want it to be.
I read through their documentation, where it says that I can use chxl=<axis_index>:|<label_1>|...|<label_n> to set custome axis labels. I tried using chxl=0:|0|5|10|15|20|25|30|35|40|45|50|55|60 to label my x-axis, from 0 to 60 with the interval of 5, but it is incrementing by the interval of 10.
This is my graph: https://image-charts.com/chart?cht=lxy&chs=999x480&chd=t:0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60|660,570,520,615,492,510,523,495,500,510,562,570,572,531,544,551,568,567,584,570,560,545,537,543,521,517,522,512,519,516,511,519,529,528,533,525,519,531,529,524,524,524,522,518,520,530,518,524,517,512,515,505,507,509,514,505,506,503,502,504,504|0,5,10,15,20,25,30,35,40,45,50,60|0,492,528,612,648,324,492,636,456,492,444,528,396&chco=ffbc8a,407bcb&chg=1,50&chxt=x,y&chls=3|3&chdl=Overall|Last%205%20seconds&chdlp=t&chxl=0:|0|5|10|15|20|25|30|35|40|45|50|55|60
As you can see from the last line of the url, I have chxl=0:|0|5|10|15|20|25|30|35|40|45|50|55|60, but if you click on the link and look at the image, the labels for the x-axis is incrementing by 10. I also tried changing the attribute to other values, but the labels always stay as 0 10 20 30 40 50 60.
Disclaimer: I'm Image-Charts founder.
Image-Charts.com was created in 2016 to be as close as possible as the now soon to be shutdown Google Image Charts API.
Here is our documentation regarding axis labels. Please use our documentation instead of the one from Google Image Charts.
Axis labels will be automatically skipped if they can't be displayed on screen.

ASP.net chart control - XValueMembers Count

This is the first time I use chart control in ASP.net
I did the binding between the chart and a datatable to show the stats of revenue per date
Although,
When the selected dates are more than 9, the chart stops displaying them all on the X axis
It displays only 5
What is the reason?
Any workaround?
Any help would be appreciated
Similar problem was found here, and people there recommends to set up some properties, like this:
Try setting the AxisX Interval property to 1
Chart1.ChartAreas[0].AxisX.Interval = 1
note that you may then also want to change the angle of the labels
And after that, as you'll get a lot of values at axis X, you should change the angle for them. like this:
Chart1.ChartAreas[0].AxisX.LabelStyle.Angle = 45
Note that Chart1 is a Id of your chart, and can be different.

Need to show min and max values in MSChart for line graph

I am using MSChart to show blood pressure values sistolic and diastolic, in line chart in a web application using asp.net. The user is allowed to choose a date range before the graph is shown, and we are required to show date in the X axis and the sistolic and diastolic values in the Y axis (two line chart in the same chart area). If the user had entered more than one value for a single day (for sistolic and diastolic), I am required to show the max and min values for sistolic and diastolic.
Is it possible to show that in MSChart, I did a lot of research and went through the samples from Microsoft but could not get any breakthrough, I am at my wits end, any help would be greatly appreciated. By the way is it possible to do that with telerik or by using Microsoft.Office.Interop.Excel dll.
Thanks in advance!
What is the difficulty that you are facing ? Adding two lines or series to the same chart area is no problem. See the Databinding options (Points.DatabindXY) in the samples from Microsoft. If you want to show the min/max as well, then you should select the right chart type like Stock charts instead of a Line chart.

How do I build a canvas line graph between 2 varying dates?

I'm trying to use canvas to build a line graph between 2 date points. I need the date measurements along the bottom of the graph to change based on the start and end date data, which can vary widely between what information is grabbed by the application. Are there any plugins that do this, specifically/dynamically?
There is a huge abundance of chart and graph plotting libraries that can do this, and gRaphaël seems to do what you ask for quite well.

Resources