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

Sparklines, decimal, domain data source view

5 Answers 169 Views
Sparkline
This is a migrated thread and some comments may be shown as answers.
Biruh MEKONNEN
Top achievements
Rank 1
Biruh MEKONNEN asked on 06 Jan 2011, 12:28 PM
Hi,

first, little question, I wanted to know if it's possible to have sparklines with decimal YValue. I had some problem to do it. I had to change it to double.
I'm using RIA Service with linq to entities. In my SQL server database, I have to work with money type fields, these fiels become decimal in linq to entites.

Then, I wanted to adapt this code found here to sparklines:

http://blogs.telerik.com/rossenhristov/posts/10-01-07/asynchronous_master-details_with_radgridview_for_silverlight_and_wcf_ria_services.aspx

However, instead of having some details, I have a sparkline column.
I have a list of projects (mainly ProjectId and ProjectTitle attributes).
In my converter, I'm doing like in the master-details example:
- The converter is calling a ria query to get asynchronously a list of entities (from a ProjectId parameter)
- The converter returns then the corresponding dataview.
Each entity has a Double attribute Alloc and a DateTime attribute DateAcctPrd.

Then in the xaml code, I bind the converter like in the following xaml code. However, I have an NullReferenceException when I run my code.
(If I'm doing a master detail, I can see in the details the list of entities, so my query is working well. If I don't add any YValuePath, I have of course a constant value in the sparklines but I don't have any exception)

Could you help me with that?
<telerik:GridViewDataColumn Header="Title" DataMemberBinding="{Binding ProjectTitle}" />
<telerik:GridViewDataColumn Header="Evolution">
      <telerik:GridViewDataColumn.CellTemplate>
            <DataTemplate>
             <telerik:RadLinearSparkline ShowFirstPointIndicator="True" ShowLastPointIndicator="True"
ShowHighPointIndicators
="True" ShowLowPointIndicators="True"
  ItemsSource
="{Binding Project_ID,Converter={StaticResource SparkConverter}}"
YValuePath="Alloc" YWidth="200" Height="20"  />             </DataTemplate>
      </telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>

5 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 10 Jan 2011, 01:02 PM
Hi Biruh MEKONNEN,

Thank you for contacting Telerik support!
We were able to reproduce this strange behavior in Sparklines using decimal values and logged in this issue in our PITS system  here. You can expect a fix in one of the upcoming LIB released every Monday. Your Telerik points have been updated for helping us pinpoint this issue. Until there is a fix you can represent your YValues as doubles.

Kind regards,
Yavor Ivanov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Biruh MEKONNEN
Top achievements
Rank 1
answered on 10 Jan 2011, 02:21 PM
Hi,

thanks for your answer !!

 I would be also very interested if there is a way to load asynchronously data to sparklines in a gridview with RIA service and LINQ to Entities.
As I wrote before, I thought about binding a dataview of a DomainDataSource to each sparkline chart via a converter. Then I would run from the DomainDataSource an asynchronous query to get the data. The problem is I guess the view is null(or the corresponding data) at the beginning and so there is a NullReference exception when the sparkline control wants to access to the attributes set in  YValuePath and XValuePath.

As I haven't found a way to load asynchronously my data, I'm using eager loading in RIA service to have the different points in my sparklines and I found a weird behavior. (a  Layout cycle detected.  Layout could not complete).

To reproduce this behavior, you should have:
- a RadGrivew with around 20 lines.
- Each line is composed of two columns, one represents just a classical GridviewDataColumn with simple bound text  and the other one is represented by a RadLinearSparkLine or a RadAreaSparkLine.
-
Each SparkLine control is bound to a List of around 12 measure points. In my case, a measure point is defined by a date (for the XValuePath) and a double (for the YValuePath). A lot of my measure points have the same value (for the YValue). But to reproduce the behavior, you should set all the measure points to have different XValue but all the same YValue (for instance 0). Thus, every point will be considered as a high or a low point.
- Then you should set the attribute ShowHighPointIndicators (or ShowLowPointIndicators) to true.  So as I just wrote before every point will be a high (or low) point.

Then normally when you run it, there is a  "Layout cycle detected.  Layout could not complete." error. Sometimes, it's working but there isn't any draw line, only plots are visible.
It is working when ShowHighPointIndicators (or ShowLowPointIndicators) is set to false.

With a RadColumnSparkline, nothing is shown but there isn't any error.

I hope I was clear enough in my explanation.

Thanks again for everything!


EDIT: for the Layout cycle detected.  Layout could not complete.
Instead of having a gridview. You can have directly a RadAreaSparkLine bound with a list of around 300 measure points (with different XValues, but same YValues) with ShowHighPointIndicators (or ShowLowPointIndicators) set to true.
0
Yavor
Telerik team
answered on 12 Jan 2011, 04:05 PM
Hello Biruh MEKONNEN,

Thank you for getting back to us!
Indeed there is an issue in sparklines when bound to an object that has the same Y value. I have already forwarded your report to our developers for further investigation and logged this issue in our PITS system here. Your Telerik points have been updated as a token of our gratitude for helping us pinpoint this issue.

Until there is a fix perhaps you can add a dummy item somewhere in your data. This will create a sparkline in which the delta of the range is not 0 and will break the conditions for this bug.

Hope this helps!

Kind regards,
Yavor Ivanov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
cpursley
Top achievements
Rank 1
answered on 15 Jan 2011, 12:02 AM
I am also experiencing this issue. Do you know when it will be resolved?
0
Yavor
Telerik team
answered on 20 Jan 2011, 09:01 AM
Hello Chris Pursley,

These issues are logged in our bug tracking system and will be resolved in a timely manner. You can visit our PITS system and vote to increase their priority. When they are resolved the PITS items will be updated so check them regularly.

Regards,
Yavor Ivanov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
Sparkline
Asked by
Biruh MEKONNEN
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Biruh MEKONNEN
Top achievements
Rank 1
cpursley
Top achievements
Rank 1
Share this question
or