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

Bar Chart w/ 2 Series (x-axis) & 1 Category (y-axis)

3 Answers 144 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 19 May 2015, 03:17 AM
I'm having an issue creating a basic bar chart at design-time.  I added a Report to my VB.NET Winforms project and added a Graph object to the Report.  I set a SQLDataSource which is a simple table that can be seen in the attachment.  I created an example bar chart in Excel with the data very easily, but can't figure out for the life of me to do it using the Graph control.  I'm in my trail period looking to purchase a reporting product, but need to know how to do the basics before purchasing.

I'm having issues determining why I need to create CategoryGroups and SeriesGroups according to your documentation.  Seems logical I should just add Series and assign the X and Y properties.  Can someone please help me understand how to setup this basic bar chart?

Thanks,

Ryan

3 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 19 May 2015, 09:07 AM
Hello Ryan,

By adding category groupings you are defining the slots in which series will be rendered. Category groupings can be on multiple levels, where data can be aggregated automatically by expanding or shrinking a group.

By adding series groupings you are defining if a single series object should generate automatically more series based on the grouping criteria.

For more details, please check the Graph's Structure and Connecting to Data articles, which elaborate on the elements of a graph and how they combine to create the whole chart.
Step by step tutorials for creating charts can be found in Chart types section, and for specific settings of the Graph elements in Formatting a Graph and the How To sections.


The attached video illustrates how to create the chart from your screenshot.


Let us know if you need any further help.

Regards,
Stef
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Ryan
Top achievements
Rank 1
answered on 20 May 2015, 08:45 PM

Hi Stef,

Very kind of you (and clever) to attach a video showing how to correct my problem.  I guess the Graph Wizard can build the graph better than I could do manually (at this time).

However, I do have a couple of following questions related to formatting (Let me know if I need to post a new thread).

1)  I want to sort the bar chart by Forecasted (Desc), Sold (Desc), SalesPerson (Asc).  The only way I can sort the chart is by setting the SortingsCollection property of the CategoryGroup (SalesPerson), right?  If so, why do I get the exact opposite sort order of what I specified (see Chart Sorting.png)?

2)  I need to show the blue bar (Forecasted series) on top of the red bar (Sold series) for each SalesPerson so the order matches the series color order of the legend.  How do I do that?  I changed the order of the Series in the GraphSeries Collection Editor, which sets the legend order correctly, but the series bar order is incorrect, why? (see Series Order.png).

0
Stef
Telerik team
answered on 22 May 2015, 02:52 PM
Hi Ryan,

On your questions:
  1. If I understand correctly the data in the chart, the issue that data is plotted from bottom to top.

    This can be changed by selecting the axis with CategoryScale and changing Graph - axis - Scale - Reversed. If you want to keep the other axis at the bottom of the Graph (as it will be put on top after reversing the first axis), add a cross axis position 'AtMaximum' for the same axis' Scale: Graph - axis - Scale - CrossAxisPosition - Add - Position=AtMaximum.

    The report in the attachment illustrates the settings.

  2. The position of the bars in one category slot is calculated sequentially away from the beginning of the coordinate system. When using horizontal bars, the first processed series (according to the group sorting) is barSeries1(Forecast), that's why it occupies the first (lowest) position in the slot. The last processed series is barSeries2(Sold), that's why it occupies the last (highest) position in the slot. However, in the legend they are added in the order they are processed, that's why barSeries1(Forecast) appears in the first place. Currently there is no way to change the order of processing the series so in some scenarios they do not match the order of their respective legend items.


    If your design allows it, you can change the chart from Bar to Column easily (just right-click on the graph and choose "Swap Axes" from the context menu). This way the order of processing the series will match the legend items ordering.

Regards,
Stef
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Ryan
Top achievements
Rank 1
Answers by
Stef
Telerik team
Ryan
Top achievements
Rank 1
Share this question
or