Android MPandroid line charts x Axis View all the labels - mpandroidchart

Hi I am using MPandroid chart library for my android app.I was able to draw the charts and mange the date and time but I wanted to show Dayly,Weekly and monthly XAxis I was able to show the Daily records. Is there any supporting method or option to show the whole x Axis data I have in the array
Ex
ArrayY(Data)
ArrayX(Dates)-Dates for the current week Starting from monday.
I have data only till Wednesday so the chart is curently showing only the xaxis up to Wednesday rest of the dates are missing and My user need to see that
Any body can help ?

You should try something like this :
myChart.setVisibleXRange(0, xVals.size() - 1);
Make sure your xVals is not empty or this may throw an error.

Related

Is it possible to add a horizontal line to an infragistics ultraSparkLine that isn't an average

I am new to using infragistic controls. I have added a ultraSparkLine to a VB 2017 application. I am doing it using in Area format. It is displaying work being accomplished during time frame. Want I would like to do is add a horizontal line that would show target rate of what is expected as work rate. I see I can have the Trendline but that seems to show average work rate for time frame being displayed.
Is it possible to add a horizontal line at a predetermined value?
There is no build in way to draw horizontal line. However you can use normal range to make something like a horizontal line. First set minimum and maximum to your chart. This will allow you to show the horizontal line above/bellow the spark line. Then set NormalRangeMaximum and NormalRangeMinimum to some very close values. For example if minimum is 0 and maximum is 100 I would set the ranges to let say 89.9 and 90.
As a final touch you can set NormalRangeFill to some brush as needed in your application.

Excel VBA Macros xlDays

I'm working on Line with markers chart. I have recorded a macro to create line chart (exactly xlLineMarkers). particularly x-axis with 7 days gap.
but it gives runtime error on
ActiveChart.Axes(xlCategory).MajorUnitScale = xlDays
I'm new to Excel VBA, please can anyone help?
apparently that doesn't work for my problem
i want to pick max and min date from datasheet and then display on x axis b y 1 week difference. can anybody help please ( in a deadlock :( )
[coding][1]
line chart
the code runs error free but doesnt show anything on x axis

Is it posible to get the position of point on an excel graph axis

I'm not sure this is possible but thought this was the best place to ask.
Is it posible to get the position of a series value on a graph in excel?
For example, if I have a line graph in excel that has time along the x axis, is it possible to (using VBA) get the position of a specific point on that axis.
What I am trying to do is have a vertical line that is can be positioned based on a date entered by the user.
like this
Where the green line could be positioned by entering in a date (rather than just being manually moved) (or also it could be set to automatically move to the current date etc).
I was then thinking that if the position is on the graph is queryable, then I can just access the line object and move it to any position I wanted through VBA.
Any Ideas? or is this just not possible?
The "cleanest" way to do this is to add the line to the chart as a new series. In that way, Excel handles all of the positioning and your work is simplified. To get a vertical line on a chart, there are a number of options. I prefer this route:
Create a small 2x2 area with two dates and two values
Add in the date or x-axis value you want the line at (E3 in image). You can use =TODAY() here or some manually entered value.
Set the second x-axis value equal to the first
Use MAX and MIN on the data to get the values for each date. You can also use 0 and 1 and a secondary axis, but I think MAX/MIN is easier.
Add the data to the chart and format as a marker with straight line.
Formulas
E3: =TODAY()
E4: =E3
F3: =MIN(C3:C27)
F4: =MAX(C3:C27)
Result and chart data series for vertical line

Creating a line in an excel chart which always shoots a red line through todays date in VBA

I have a chart which I would like to always run a line through today's date after I run a Macro I am working with. I would also like it to say Today right above the chart and above the red line. I would like to code this out in VBA but I don't really know where to begin. I have the chart Does this make sense? Thanks.
Read through this and combine with =TODAY().
Edit: The specific formula you'd be using for your column of vertical lines is
=IF('cell in same row containing date'=TODAY(),MAX('range of your data'),"")
This formula will return the max from your list of data if the date in your table is today's. If you follow the instructions for option 2 from the link and create another data series for vertical lines and put this formula in that column, you will have a vertical line that is always on today's date.
One more Edit: To address having "Today" above the line, add data labels to your "Today" series by right clicking on the series and going to "Add Data Labels." Right click on the Data Labels and go to "Format Data Labels." Go to "Number" and select Custom. Enter "Today";;; into the Format Code box and click add. Your Data Labels for your blanks should go away and your date line should have "Today" over it. Format it however you wish.
And if you want to make this part of a macro, record it and play around with the code you get until you find something that works. IMO, just having this as a part of your chart is easy enough.
Last edit I swear: If your line is too fat, right click on the series/line, go to "Format Series," change the fill to a gradient, set the rotation to 180*, and play around with the stop positions and transparencies to make the line appear thinner. That's all I've got, so if I've helped in any small way, mark this as useful.

Connect Xaxis of a chart to another one

I have an application made of a "main" chart with stock quotes plotted in it and a "subordinated" one with some indicators; the two charts are dinamically feeded with data so they are ever moving and re-sizing their own YAxis accordingly. The following snapshot gives a better idea:
What I would like to do is to make the below chart XAxis exactly the same of the first one, so that it is possible to follow the evolution of the two indicators together.
Right now I'm doing the following work around:
With ChartBelow.ChartAreas(0)
.AxisX.Minimum = ChartAbove.ChartAreas(0).AxisX.Minimum
.AxisX.Maximum = ChartAbove.ChartAreas(0).AxisX.Maximum
End With
However this doesn't work well since the digits of the YAxis on the main chart are not always the same of the second one (as in the example above where it's 6-digits against 3-only).
Is there any way to aligne the two y-axes or make the X-Axis shared between the two charts?
Yes, as well as setting the Min/Max values, also set the interval and label interval values of the Axis.
ChartAbove.ChartAreas(0).XAxis.Interval
ChartAbove.ChartAreas(0).XAxis.LabelStyle.Interval