In this video, youíll learn how to work with
Charts and Sparklines inside of reports.
Iíve already created a master detail report,
based on the Northwind database, I used the
categories table as the master area of the
report and the products as the detail.
You can see how that's set up here.
If I go to the report exploreróYouíll see
in the details section each of the categories,
and then in the detail report I have each
of the productsÖYou can also see that via
the Field List-
letís take a look at the report.
We want to look at a chart that compares each
item in stock vs on order numbers.
First, let me explain how data is set up inside
the report.
In this detail section, we have a series of
repeating category items, in this section
we have a series of repeated product items
that belong to each category.
But we have this header that represents all
of them for each particular category.
Since that's the case weíre going to drop
the chart directly into the group header.
First, letís make this a little biggerótake
these items and move them down, next from
the toolbox drag a chart directly onto the
design surfaceóand immediately youíll see
the chart wizard appearóWeíll choose the
bar chart- leave the appearance at default-
remove the series that have already been added
and ADD one ourselves.
This one will be the in stock series, notice
to bind the data properly, if you go over
to the data section in series binding youíll
see that weíre automatically bound to the
right thing.
Now, weíre trying to bind to the series of
products that belong to each category- in
order to do that, we go to the arguments section,
we scroll up and we go to the category products
data section then we choose the product name
as the argument.
Next as the value weíre going to choose the
units in stock.
Weíll go ahead and hit finishóand resize
this so it fits a little bit better.
Now notice when you hit preview you can see
all the items in stock for this category,
namely, beverages.
Lets do some in house cleaning to make this
chart better, and letís add the on order
series.
Click on the smarttag and select run Wizard-
and go back to series, weíll add another
one and call it On Order.
Next, weíll go to the data section, and in
the series binding weíll go back to the on
order series and weíll bind it appropriately
again.
Notice weíre binding to the categories products
section.
So weíll select product name and then weíll
go to value and then weíll select units on
order.
Next, letís go to the Axesóand on the primary
y axis and the on the primary x axis weíll
remove the names so theres more space.
Letís introduce an additional pane to see
them one on top of the other (rather than
side by side)
Go to the diagrams section, go to elements,
and add a new pane.
We have another available chart that will
directly compare these 2 items.
In order to move the on order items down,
weíll go to series views, weíll choose on
order, and weíll move it to the new pane.
Next, Iíll go to the point labels for each
of these itemsÖ and remove them.
In the case of the ON Order Iím going to
select what we're going to show, in this case
instead of showing the values, Iíll show
the Arguments.
Next, go to overlapping and select default,
so that items donít overlap.
And now go to legend and remove itÖ finally
weíll add a chart title.
And move it to the right.
In keeping with our style weíll go to SEGOE
UI- as our font.
Ok, lets hit finish.
Now as we go to preview youíll see weíre
looking at items on order, vs the items in
stock.
But it seems there are certain items in stock
that arenít being sold.
And those that are being sold, looks like
their stock is low.
You can see this is repeated for each category.
Ok- now, Iíll show you how to add a Sparkline!
So, it would be nice to see a sparkline showing
many items were ordered, per each order.
Letís add some data from the northwind dataset.
Weíll go to the Server Explorer and we'll
drag order details on.
Order Details is a sub-item of products.
In other words thereís an order for each
product that's represented inside of these
order details.
Also a Quantity is displayed.
Now Iíll show a sparkline that shows the
quantity being ordered for the product over
the lifetime of that product.
To do that, letís go over to the details
section.
Weíll get a little more space and from the
toolbox weíll drag a sparkline control onto
the design surface.
Next, weíll bind itÖchoose the northwind
dataset as its datasource, and as the data
member weíre going to drill down to categories,
and notice weíre in category products but
we want to select the product orders because
that's going to have a number of values for
each product.
So lets select that.
Next we need to create a table adapter for
it, weíll drop down and select the order
details table adapter and finally as a value
member weíll select quantity.
Next lets change the view type area and then
letís change the color.
Go to the view section and in the color area
weíll choose a bluish color that's not too
loud.
In this case weíll choose Steel Blue.
Finally, recall previously when we looked
at this report there was an odd and an even
style, we want this sparkline to obey the
odd style as well.
To do that, weíll go to the sparkline itself,
weíll scroll down to styles and under odd
style, weíll select the off style we generated
for the other elements.
And that's it!
Weíve effectively created a chart to show
in stock vs on order for every product in
a series of categories then we added a child
table to the products table and created a
sparkline showing how many of these items
were ordered per each order.
Thanks for watching and thank you for choosing
devexpress.
