Recent

Author Topic: [SOLVED] Remove empty dates on Bar Graph  (Read 4454 times)

Odacir

  • New Member
  • *
  • Posts: 44
[SOLVED] Remove empty dates on Bar Graph
« on: May 05, 2016, 11:12:47 pm »
Hi,

I trying to show a bar graph, with dates on X-axis, using a DBChartSource.

The graph is OK, show the results, but not all days have values.... But the days without values is showed on graph. How to not show empty values?

See the attachment. The table is the values.
« Last Edit: May 06, 2016, 11:02:09 pm by Odacir »

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: Remove empty dates on Bar Graph
« Reply #1 on: May 06, 2016, 10:30:33 am »
Your dataset contains non-equally spaced date values which are used for the x coordinates of the bars. Therefore, there are irregular gaps between the bars.

Use the datapoint index as x instead. In case of a TDbChartSource, just leave the FieldX empty. Now you'll see the indexes being plotted along the x axis. To get the dates back as labels, add the name of the date field to FieldText of the DBChartSource, and link the DBChartSource to the Marks.Source of the Chart's BottomAxis. Set the Style of the Marks (of the BottomAxis) to smsLabel.

Just look at the settings in the attached project (you'll need TMemDataset)

Odacir

  • New Member
  • *
  • Posts: 44
Re: Remove empty dates on Bar Graph
« Reply #2 on: May 06, 2016, 09:45:41 pm »
WP, really thanks a lot! Your answer was perfect. Exactly what i need!!!!  :)

Its possible show at top any bar, show the value of Y axis?

Really thanks for your time to help-me.

Have a good weekend!

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: Remove empty dates on Bar Graph
« Reply #3 on: May 06, 2016, 10:07:20 pm »
Its possible show at top any bar, show the value of Y axis?

The series has a Marks property as well. Set its Style to smsValue to show the data value. Format the text boxes using the other properties of Marks.

Odacir

  • New Member
  • *
  • Posts: 44
Re: Remove empty dates on Bar Graph
« Reply #4 on: May 06, 2016, 10:35:08 pm »
One more perfect answer.

Thanks a lot WP

:-)

 

TinyPortal © 2005-2018