cancel
Showing results for 
Search instead for 
Did you mean: 

How to Add a Vertical Line to Bar-Chart to show Todays' Date

Former Member
0 Kudos

I created a Horizontal Bar Chart tracking titles and expiration dates (Titles on the side and Dates on the bottom).

Managers want to see a vertical line that shows today's date.  Is this possible?

Accepted Solutions (1)

Accepted Solutions (1)

JWiseman
Active Contributor
0 Kudos

hi Vince,

i'm assuming that your dates are coming in as numbers on the horizontal Show Value axis correct? e.g. yyyyMMdd.

if so, create a new formula with syntax like this

tonumber(totext(currentdate,'yyyyMMdd'))

now go back to the chart expert and add the new formula as a Show Value.

preview the report, right click on the new series and choose Series Options and in the Appearance tab change Show Selected Series to "Line".

if you don't like the markers on the line, then create a new chart, type = Line (horizontal) and then change the series you had before to Riser. by using a Line type chart you have more control over the formatting of the line.

-jamie

Former Member
0 Kudos

Jamie:

Thanks for the formula.  It did not work the way I wanted.  I already have "CONTRACT_EXPIRATION" in the 'Show Value(s)' window.

As shown in the "Capture1_With_Output.png" image.

When I added the formula the output I got is shown in "Capture2_With_Output.png"

I then made the change to the series and the output for that is in "Capture3_With_Output.png"

-Vince

JWiseman
Active Contributor
0 Kudos

hi Vince,

your current date formula doesn't look correct...it looks like it has a year of 1999. what is the syntax of this formula? also, ensure that you have one series as a Riser and the other series as a Line.

depending on how you've formatted your chart, it should look roughly like this.

-jamie

Former Member
0 Kudos

Jamie:

Here is the formula that I am using to get the EXPIRATION Date (in the png file)

Whenever I try to change the series to 'line', it goes back to:  "Default for Chart Type"

Your help is greatly appreciated.

-Vince

JWiseman
Active Contributor
0 Kudos

that is the Record Selection formula in the pic. what is the formula for Current Date and what is the formula for the Expiration Date that you're trying to use in the Chart's Show Value?

what version of crystal reports are you using? are you using visual studio?...if so this may not be possible. if that's the case then you'd need to try this out in the full version of the crystal reports designer. you can get a trial here.

if you are using the full version of the designer then try creating a new chart instead of editing the existing one. sometimes you'll get weird issues like that if a chart has been edited many times.

Former Member
0 Kudos

I am brand new to CRYSTAL Reports. 

After I built the report, I was asked to add a chart, which I did.

I brought up the Chart Expert and selected the field "MODEL.MODEL_NAME" for "For each rercord"

I then selected the field "ASSET.CONTRACT_EXPIRATION" for the "Show value(s) selection.

The chart looked great!!  I was then asked if I could add a vertical line for todays date, whenever the report gets run.

I am not sure what you are asking me about "...the formula for the Expiration Date in the Chart's Show Value",

1.  Where is the 'Chart's Show Value'

2.  The Expiration Date is coming right from the table and the formua that I showed you

JWiseman
Active Contributor
0 Kudos

the Show Value is in the Chart Expert > Data tab.

I would recommend that you recreate the chart, starting with a Line type chart as suggested above. I can create this type of chart with no issue on crystal v 14.1.1.1036.

before you try the new chart though:

1) have a look at the attachment. extract the contents and change the .txt extension to .rpt.

2) right click on the chart and go to Chart Expert and click through all of the tabs.

3) then right click on each series (first the Line and then the Bar) and choose Series Options and have a look at the first tab.

4) right click on one of the horizontal axis dates and choose Chart Options and have a look at each tab.

5) right click on one of the horizontal axis dates and choose Data (Y) Axis Options and have a look at all of the tabs.

Former Member
0 Kudos

Jamie:

Thank you for all of your inputs for this chart example.  Much appreciated.

Answers (0)