This is a migrated thread and some comments may be shown as answers.

Graph bar chart - adjust display depending on number of records

4 Answers 95 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Joan
Top achievements
Rank 1
Joan asked on 05 Mar 2014, 02:32 PM


I have a GRAHP bar chart that works graet with 10 records coming from the database, however when thre are 100 records, they are very narrow and hard to read.

This graph is in library and its DataSource is binding directly from the database procedure to the graph so there is no place to check for number of records in the C# code.

Would it be possible to have the width of the bars always the same and if there are 10 records, they would display on first page, if there are 100 records, then the X axis would extend to the right and display on the next pages? Can this be accomplished in the designer settings?

The graph contains cartesian coordinate system, datasource (stored procedure), bar series, category and numerical scale.

(All data has to be displayed, I cannot use filters.)

4 Answers, 1 is accepted

Sort by
0
Hinata
Top achievements
Rank 1
answered on 10 Mar 2014, 11:29 AM
Hi Joan,

You can set a binding for graph's property Width = "Xpx", where X will be a number which you will determine based on your data.
0
Joan
Top achievements
Rank 1
answered on 10 Mar 2014, 03:40 PM
Hardik, That sounds like a great idea, however I am not sure how I can get the total number of records on my X axis.
(I do not have DataBind, I only have DataSource that maps directly to the graph.)
0
Hinata
Top achievements
Rank 1
answered on 13 Mar 2014, 03:26 PM
Hello Joan,

You can set a value in the binding expression of the Width property based on the data coming from the data source. To do this you will need to fetch the data (number of records) programmatically inside a user function and then use the user function in the binding expression.
0
Joan
Top achievements
Rank 1
answered on 14 Mar 2014, 07:04 PM
Hardik, do you have a code example? That would be very helpful.
Tags
General Discussions
Asked by
Joan
Top achievements
Rank 1
Answers by
Hinata
Top achievements
Rank 1
Joan
Top achievements
Rank 1
Share this question
or