Plotting StackedColumnGraph of visiblox in WP7 dynamically - windows-phone-7

I am facing a problem in binding the values to the StackedColumnGraph of visiblox in WP7 dynamically.
the XAML code has hard coded values..
<UserControl.Resources>
<Style x:Key="NoBorder" TargetType="Border">
<Setter Property="BorderThickness" Value="0" />
<Setter Property="BorderBrush" Value="Black" />
</Style>
<local:PartyList x:Key="Labour" >
<local:ElectionResult Year="1997" VotesMillions="13.5" />
<local:ElectionResult Year="2001" VotesMillions="10.7" />
<local:ElectionResult Year="2005" VotesMillions="9.6" />
<local:ElectionResult Year="2010" VotesMillions="8.6"/>
</local:PartyList>
<local:PartyList x:Key="Conservatives">
<local:ElectionResult Year="1997" VotesMillions="9.6" />
<local:ElectionResult Year="2001" VotesMillions="8.4" />
<local:ElectionResult Year="2005" VotesMillions="8.8" />
<local:ElectionResult Year="2010" VotesMillions="10.7"/>
</local:PartyList>
<local:PartyList x:Key="LibDem">
<local:ElectionResult Year="1997" VotesMillions="5.2" />
<local:ElectionResult Year="2001" VotesMillions="4.8" />
<local:ElectionResult Year="2005" VotesMillions="6.0" />
<local:ElectionResult Year="2010" VotesMillions="6.8"/>
</local:PartyList>
<local:PartyList x:Key="Others">
<local:ElectionResult Year="1997" VotesMillions="2.9" />
<local:ElectionResult Year="2001" VotesMillions="2.5" />
<local:ElectionResult Year="2005" VotesMillions="2.8" />
<local:ElectionResult Year="2010" VotesMillions="3.5"/>
</local:PartyList>
I have a Collection where the fetched data from the service are stored,One thing I need to know how to bind those values with these hard coded values to plot the graph...

You might want to take a look at the following blog post as that explains in general terms how to bind data to a Visiblox Charts. In short, there's a few different options depending on at which level you're trying to do the binding but the BindableDataSeries is the basic building block.
http://www.visiblox.com/blog/2011/06/data-binding-with-visiblox-charts
[Disclaimer: I work for Visiblox]

Related

Why does Animation not work in Avalonia? it said Unable to cast object of type 'Avalonia.Animation.AnimatorKeyFrame' to type 'Avalonia.IStyledEleme;

I want to make a animation like
<Style.Animations>
<Animation Duration="0,0,1" PlaybackDirection="Normal" FillMode="None">
<KeyFrame KeyTime="0.5">
<Setter Property="Width" Value="{TemplateBinding Width}" />
<Setter Property="Height" Value="{TemplateBinding Height}" />
</KeyFrame>
</Animation>
</Style.Animations>
but it tell me Unable to cast object of type 'Avalonia.Animation.AnimatorKeyFrame' to type 'Avalonia.IStyledEleme;
How can I Solve the problem?

Add behavior to style setter

i'm new Xamarin, can anyone suggest, how to add behaviors to the style of control in Xamarin xaml.
I have some ClickableImageBehavior and some imageBaseStyle, how to associate behavior with setter?
UPD
Details:
So... problem:
public class ClickableImageBehavior : Behavior<Image>
{
// handle user tap on button.
}
And using looks like this:
<Image>
<Image.Behaviors>
<view:ClickableImageBehavior/>
</Image.Behaviors>
</Image>
But i don't want to write this xaml on every button that has ClickableImageBehavior
I want to create some base style with this behavior and base properties and simple inherit it in every image like
<Image style="{StaticResource clickableImageStyle"/>
In WPF i can deal with it like in this article, but how to do it in Xamarin xaml?
I'm not really an expert but when I added a behaviours it was always in a component like
<psc:EnumBindablePicker x:Name="enumpickerSpeechPart">
<psc:EnumBindablePicker.Behaviors>
<pscv:PickerBehavior x:Name="pickerBehaviorSpeechPart" />
</psc:EnumBindablePicker.Behaviors>
</psc:EnumBindablePicker>
In the ResourceDictionary you can add calls to converters.
<local:BooleanToObjectConverter x:Key="boolToStyleImage" x:TypeArguments="Style">
<local:BooleanToObjectConverter.FalseObject>
<Style TargetType="Image">
<Setter Property="HeightRequest" Value="20" />
<Setter Property="Source" Value="{local:ImageResource Images.error.png}" />
</Style>
</local:BooleanToObjectConverter.FalseObject>
<local:BooleanToObjectConverter.TrueObject>
<Style TargetType="Image">
<Setter Property="HeightRequest" Value="20" />
<Setter Property="Source" Value="{local:ImageResource Images.success.png}" />
</Style>
</local:BooleanToObjectConverter.TrueObject>
</local:BooleanToObjectConverter>

How to add horizontaly aligned static text on the Y axis of a Telerik chart

I have a telerik RadCartesianChart and i just want to add horizontaly aligned static text on the Y axis of the chart.
Below is the chart xaml`
<telerik:RadCartesianChart.VerticalAxis>
<telerik:LinearAxis Minimum="-10" Maximum="100" MajorStep="10" FontFamily="Verdana" FontSize="9" ShowLabels="True" LabelFitMode="None">
</telerik:LinearAxis>
</telerik:RadCartesianChart.VerticalAxis>
<telerik:RadCartesianChart.HorizontalAxis>
<telerik:LinearAxis Minimum="1" Maximum="100" MajorStep="10" ShowLabels="True" FontFamily="Verdana" FontSize="9" >
</telerik:LinearAxis>
</telerik:RadCartesianChart.HorizontalAxis>
<telerik:RadCartesianChart.Grid>
<telerik:CartesianChartGrid MajorLinesVisibility="XY">
<telerik:CartesianChartGrid.MajorXLineStyle>
<Style TargetType="Line">
<Setter Property="Stroke" Value="#868686"/>
</Style>
</telerik:CartesianChartGrid.MajorXLineStyle>
<telerik:CartesianChartGrid.MajorYLineStyle>
<Style TargetType="Line">
<Setter Property="Stroke" Value="#868686"/>
</Style>
</telerik:CartesianChartGrid.MajorYLineStyle>
</telerik:CartesianChartGrid>
</telerik:RadCartesianChart.Grid>
<telerik:RadCartesianChart.Series>
<telerik:ScatterPointSeries Cursor="Arrow" DisplayName="Name" ItemsSource="{Binding}" ShowLabels="True" >
<telerik:ScatterPointSeries.XValueBinding>
<telerik:PropertyNameDataPointBinding PropertyName="X" ></telerik:PropertyNameDataPointBinding>
</telerik:ScatterPointSeries.XValueBinding>
<telerik:ScatterPointSeries.YValueBinding>
<telerik:PropertyNameDataPointBinding PropertyName="Y"></telerik:PropertyNameDataPointBinding>
</telerik:ScatterPointSeries.YValueBinding>
<telerik:ScatterPointSeries.LabelDefinitions>
<telerik:ChartSeriesLabelDefinition HorizontalAlignment="Center" Strategy="{StaticResource strategy}">
</telerik:ChartSeriesLabelDefinition>
</telerik:ScatterPointSeries.LabelDefinitions>
</telerik:ScatterPointSeries>
<!--ScatterAreaSeries-->
<telerik:ScatterAreaSeries XValueBinding="X" YValueBinding="Y" ZIndex="-200" Fill="Red" ShowLabels="True">
<telerik:ScatterAreaSeries.DataPoints>
<telerik:ScatterDataPoint XValue="0" YValue="200"/>
<telerik:ScatterDataPoint XValue="200" YValue="0"/>
</telerik:ScatterAreaSeries.DataPoints>
</telerik:ScatterAreaSeries>
<telerik:ScatterAreaSeries XValueBinding="X" YValueBinding="Y" ZIndex="-200" Fill="Yellow" ShowLabels="True">
<telerik:ScatterAreaSeries.DataPoints>
<telerik:ScatterDataPoint XValue="0" YValue="140"/>
<telerik:ScatterDataPoint XValue="140" YValue="0"/>
</telerik:ScatterAreaSeries.DataPoints>
</telerik:ScatterAreaSeries>
<telerik:ScatterAreaSeries XValueBinding="X" YValueBinding="Y" ZIndex="-200" Fill="Green" ShowLabels="True">
<telerik:ScatterAreaSeries.DataPoints>
<telerik:ScatterDataPoint XValue="0" YValue="90" Label="Category" />
<telerik:ScatterDataPoint XValue="90" YValue="0"/>
</telerik:ScatterAreaSeries.DataPoints>
<telerik:ScatterAreaSeries.LegendSettings>
<telerik:SeriesLegendSettings Title="Low Moderate High Significant Critical" />
</telerik:ScatterAreaSeries.LegendSettings>
</telerik:ScatterAreaSeries>
</telerik:RadCartesianChart.Series>
</telerik:RadCartesianChart>`
all i needed was setting the Title property
<telerik:RadCartesianChart.VerticalAxis>
<telerik:LinearAxis Minimum="-10" Maximum="100" MajorStep="10" FontFamily="Verdana" FontSize="9" ShowLabels="True" LabelFitMode="None" Title="This is all i needed to set">
</telerik:LinearAxis>
</telerik:RadCartesianChart.VerticalAxis>

SSRS: "Index was out of range" in VS2010 but not when report is deployed

I have a simple report that keeps throwing the "index was out of range" error when i try to preview the report in VS. when i deploy the report to SSRS, it works perfectly. I've thoroughly looked for an answer already but none of them seem to apply to my situation.
Error: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index.
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<Body>
<ReportItems>
<Textbox Name="textbox1">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Sales Report</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
<FontSize>20pt</FontSize>
<FontWeight>Bold</FontWeight>
<Color>SteelBlue</Color>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>textbox1</rd:DefaultName>
<Height>0.36in</Height>
<Width>7.5in</Width>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Tablix Name="Tablix1">
<TablixCorner>
<TablixCornerRows>
<TablixCornerRow>
<TablixCornerCell>
<CellContents>
<Textbox Name="Textbox5">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Sales Person</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox5</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCornerCell>
</TablixCornerRow>
</TablixCornerRows>
</TablixCorner>
<TablixBody>
<TablixColumns>
<TablixColumn>
<Width>1.35417in</Width>
</TablixColumn>
</TablixColumns>
<TablixRows>
<TablixRow>
<Height>0.25in</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="Textbox4">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=SUM(Fields!Amount.Value * Fields!ExchangeRate.Value)</Value>
<Style>
<Format>0.##</Format>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox4</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
</TablixCells>
</TablixRow>
</TablixRows>
</TablixBody>
<TablixColumnHierarchy>
<TablixMembers>
<TablixMember>
<Group Name="Year">
<GroupExpressions>
<GroupExpression>=Fields!Year.Value</GroupExpression>
<GroupExpression>=Fields!Month.Value</GroupExpression>
</GroupExpressions>
</Group>
<SortExpressions>
<SortExpression>
<Value>=Fields!Year.Value</Value>
</SortExpression>
</SortExpressions>
<TablixHeader>
<Size>0.28125in</Size>
<CellContents>
<Textbox Name="Year">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=MonthName(Fields!Month.Value, True) & " " & Fields!Year.Value</Value>
<Style>
<Format>0.##</Format>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Year</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixHeader>
</TablixMember>
</TablixMembers>
</TablixColumnHierarchy>
<TablixRowHierarchy>
<TablixMembers>
<TablixMember>
<Group Name="RowGroup">
<GroupExpressions>
<GroupExpression>=Fields!SalesPerson.Value</GroupExpression>
</GroupExpressions>
</Group>
<TablixHeader>
<Size>1.26042in</Size>
<CellContents>
<Textbox Name="SalesPerson">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!SalesPerson.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>SalesPerson</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixHeader>
</TablixMember>
</TablixMembers>
</TablixRowHierarchy>
<DataSetName>SalesLines</DataSetName>
<Top>0.42944in</Top>
<Height>0.53125in</Height>
<Width>2.61459in</Width>
<ZIndex>1</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
</Style>
</Tablix>
</ReportItems>
<Height>0.96069in</Height>
<Style />
</Body>
<Width>8in</Width>
<Page>
<PageHeight>8.5in</PageHeight>
<PageWidth>11in</PageWidth>
<LeftMargin>1in</LeftMargin>
<RightMargin>1in</RightMargin>
<TopMargin>1in</TopMargin>
<BottomMargin>1in</BottomMargin>
<Style />
</Page>
<AutoRefresh>0</AutoRefresh>
<DataSources>
<DataSource Name="Reporting">
<DataSourceReference>Reporting</DataSourceReference>
<rd:SecurityType>None</rd:SecurityType>
<rd:DataSourceID>aab21363-546f-4445-8789-9975de5d56bf</rd:DataSourceID>
</DataSource>
</DataSources>
<DataSets>
<DataSet Name="SalesLines">
<Query>
<DataSourceName>Reporting</DataSourceName>
<CommandText>SELECT SalesPerson, exchangeRate, Amount, Year(PostingDate) AS [Year], Month(PostingDate) AS [Month] FROM [dbo].[ReportingSalesLines]
WHERE PostingDate BETWEEN '2012-10-01' AND '2013-09-30'</CommandText>
<rd:UseGenericDesigner>true</rd:UseGenericDesigner>
</Query>
<Fields>
<Field Name="ExchangeRate">
<DataField>exchangeRate</DataField>
<rd:TypeName>System.Decimal</rd:TypeName>
</Field>
<Field Name="SalesPerson">
<DataField>SalesPerson</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Amount">
<DataField>Amount</DataField>
<rd:TypeName>System.Decimal</rd:TypeName>
</Field>
<Field Name="Year">
<DataField>Year</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="Month">
<DataField>Month</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
</Fields>
</DataSet>
</DataSets>
<Language>en-US</Language>
<ConsumeContainerWhitespace>true</ConsumeContainerWhitespace>
<rd:ReportUnitType>Inch</rd:ReportUnitType>
<rd:ReportID>7d9922c6-e37f-4826-b58e-bd8b9427da1c</rd:ReportID>
</Report>
I've seen this happen when a DataSet has changed its definition but the actual cached data stored by Visual Studio (i.e. the *.rdl.data file) still has data based on the old Dataset definition; this is in internal error caused by the mismatch between the data the report is expecting and what has been cached.
To resolve this, delete any *.rdl.data files from the report solution then try previewing again.
This is why the report works fine when deployed - the report is generating new data when run so there is no mismatch with any cached data.
A Rebuild Solution command in VS may also be required.
I have had this happen several times for different reasons but recently simply unchecking 'keep together on one page if possible' under the page break options for a very large tablix fixed it.
This happened with me as well and I ended up wasting few hours on it. Here is one of the really helpful links I found out. In my case problem disappeared when I restarted my PC
In case anyone else comes across this problem, I had the same problem, but a wider search of the internet suggested it may be a whitespace issue in the report design (I was getting the same problem with the report published to Sharepoint, which I believe doesn't cache the data to a .rdl.data file.
So the solution that appears to have worked for me is to just mess around with the whitespace. My report layout uses tables with nested tables, so I tidied up empty rows, fixed row heights, and closed up gaps between separate tables. I also reduced the sizes of the header and footer.
I'm still not sure exactly which of these actions cured it, but the general tidy-up and removal of unnecessary whitespace appeared to do the trick for me
Had the same problem, but none of the above fixed it for me.
The issue for me was caused by a parameter that was populated by a dataset and its default value wasn't correctly being set. The default was 'All' which in my case looked like this:
\[Sender Analytical Structure\].\[Business Unit Name\].&\[All\]

Looking for code to update a textbox on a SpreadsheetML doc (client using VB.Net but I can read and convert C#)

I have a 2010 Excel Spreadsheet (OpenXML) with a textbox "LengthVariableTextBox" on it. I wish to change the textbox value (currently ##.# just as a placeholder) using the openxml SDK with VB.Net (perfered) or C#. Below is a XML fragment from drawing7.xml showing the textbox.
Thanks for the Help!
M. Scott Blalock
<xdr:twoCellAnchor>
<xdr:from>
<xdr:col>2</xdr:col>
<xdr:colOff>502920</xdr:colOff>
<xdr:row>8</xdr:row>
<xdr:rowOff>45720</xdr:rowOff>
</xdr:from>
<xdr:to>
<xdr:col>3</xdr:col>
<xdr:colOff>510540</xdr:colOff>
<xdr:row>9</xdr:row>
<xdr:rowOff>76200</xdr:rowOff>
</xdr:to>
<xdr:sp macro="" textlink="">
<xdr:nvSpPr>
<xdr:cNvPr id="287" name="3:24 PM 9/19/2012" />
<xdr:cNvSpPr txBox="1" />
</xdr:nvSpPr>
<xdr:spPr>
<a:xfrm>
<a:off x="1722120" y="1386840" />
<a:ext cx="617220" cy="198120" />
</a:xfrm>
<a:prstGeom prst="rect">
<a:avLst />
</a:prstGeom>
<a:solidFill>
<a:schemeClr val="tx1" />
</a:solidFill>
<a:ln w="9525" cmpd="sng">
<a:solidFill>
<a:schemeClr val="lt1">
<a:shade val="50000" />
</a:schemeClr>
</a:solidFill>
</a:ln>
</xdr:spPr>
<xdr:style>
<a:lnRef idx="0">
<a:scrgbClr r="0" g="0" b="0" />
</a:lnRef>
<a:fillRef idx="0">
<a:scrgbClr r="0" g="0" b="0" />
</a:fillRef>
<a:effectRef idx="0">
<a:scrgbClr r="0" g="0" b="0" />
</a:effectRef>
<a:fontRef idx="minor">
<a:schemeClr val="dk1" />
</a:fontRef>
</xdr:style>
<xdr:txBody>
<a:bodyPr vertOverflow="clip" wrap="square" rtlCol="0" anchor="t" />
<a:lstStyle />
<a:p>
<a:r>
<a:rPr lang="en-US" sz="1100">
<a:solidFill>
<a:schemeClr val="bg1" />
</a:solidFill>
</a:rPr>
<a:t>##.#</a:t>
</a:r>
</a:p>
</xdr:txBody>
</xdr:sp>
<xdr:clientData />
</xdr:twoCellAnchor>
Here is the answer:
http://social.msdn.microsoft.com/Forums/en-US/oxmlsdk/thread/3eb9075a-de13-4f4a-a83d-c42cdb6b8e98

Resources