How to theme Series when using a theme.xml in system.web.helpers.chart - asp.net-mvc-3

The support on this is currently horrible.
I'm creating my own theme for a System.Web.Helpers.Chart by using a XML file.
I've figured that the XML is basically a serialized version of the UIDataVizualazation namespace.
It works fine but I have no idea how to set theme objects tied to the Series property.
<Chart >
<ChartAreas>
<ChartArea>
<AxisY>
<MajorGrid />
</AxisY>
<AxisX>
<MajorGrid />
</AxisX>
</ChartArea>
</ChartAreas>
<Legends>
<Legend />
</Legends>
</Chart>
This is something I can manage pretty easily but according to the Chart object System.Web.UI.DataVisualization.Charting.Chart
has a series property that is a collection of series objects and
<Series>
<Series />
</Series>
Just doesn't do it. So if someone can point me towards a Xml schema for this or a pointer on how to access the Series property so I can change things like isValueShownAsLabel attribute I would appriciate it

Through experimentation I found that the case matters.
It should be:
<Series>
<series>
</series>
</Series>
Also this property may be of usefulness to anyone that is looking for an answer to this:
CustomProperties="PieLabelStyle=Outside"
Which can be placed in a series or point and perhaps other elements as well.
A list of the properties can be found here.

You can Serialize and Deserialize Chart yourself.
Take a look here Chart Serialization

I know this is too late to help you now but you can change series properties such as line width, colour, and labelling using
<Series>
<Series Name="Default" _Template_="All" BorderWidth="3" IsValueShownAsLabel="True" />
</Series>

Related

How to add a converter to parameterized messages in JSF 1.2?

I'm looking for a way to convert my params in a parameterized text inside a JSF 1.2 xhtml page.
Let's say I have this parameterized message in my messages.properties (please ignore the stupidity of this example):
EXAMPLE_TEXT=Right now {0} Euro is {1} US-Dollar.
And I would like the output to look like this:
Right now 1 Euro is 1.3658 US-Dollar.
Then my xhtml code looks like this:
<h:outputFormat value="#{messages.EXAMPLE_TEXT}">
<f:param value="#{backingBean.euroValue}" />
<f:param value="#{backingBean.dollarValue}" />
</h:outputFormat>
I already have implemented a converter (let's say its ID is bigDecimalConverter) that converts numeric values to the particular formats.
My question now is: (How) can a converter be registered to the output's param values?
I imagine something like this (which unfortunately seems to not be possible):
<h:outputFormat value="#{messages.EXAMPLE_TEXT}">
<f:param value="#{backingBean.euroValue}" converter="bigDecimalConverter" />
<f:param value="#{backingBean.dollarValue}" converter="bigDecimalConverter" />
</h:outputFormat>
Asking google I found this thread, but it's no sufficient answer to my specific problem.
Thanks a lot in advance for any help!
You can have exact the same output with outputText:
1) Change output to <h:outputText value="#{messages.TEXT1} #{backingBean.euroValue} #{messages.TEXT2} #{backingBean.dollarValue} #{messages.TEXT3}" />
2) Create method in backing bean which return full String and call it in output text.
(This answer was transformed from previous comment)

Get the selected values from a rich:select which is inside o a4j:repeat

I am using a a4j:repeat control to iterate throughtout a Map<Object, List<MyType>> list. The XHTML page displays both h:outputText and rich:select controls.
I loop throughout a Map<String, List<Items>> instance, to show a master-detail tables. In the h:outputText I show the master description and the rich:select shows the detail.
The code is as follows:
customer.xhtml
<a4j:repeat value="#{masterManagedBean.listMasterItems.entrySet().toArray()}"
var="itemsVar">
<h:outputText value="#{itemsVar.key}" />
<rich:select enableManualInput="true">
<f:selectItems value="#{itemsVar.value}" id="itemsMenu"
var="itemsVarSelect"
itemLabel="#{itemsVarSelect.descriptionItems}"
itemValue="#{itemsVarSelect.idItems}" />
</rich:select>
</a4j:repeat>
This snippet works perfect. But, I don't have any idea how to gain the selected value from every rich:select generated by the repeater. Please guidance me to solve this issue.
Basically I would suggest not to use the datastructure Map<String,List> for the described case. Why not changing the Structure into a normal List of objects (List<SelectionObject>) with the SelectionObject-class holding:
name/label
possible values (as List or Array)
selected value
So the JSF code would look something like
<a4j:repeat value="#{masterManagedBean.listMasterItems}"
var="itemsVar">
<h:outputText value="#{itemsVar.label}" />
<rich:select enableManualInput="true" value="#{itemsVar.selectedValue}">
<f:selectItems value="#{itemsVar.possibleValues}" id="itemsMenu"
var="itemsVarSelect"
itemLabel="#{itemsVarSelect.descriptionItems}"
itemValue="#{itemsVarSelect.idItems}" />
</rich:select>
</a4j:repeat>
Any preparations/building for this object structure can be done e.g. in getListMasterItems (use some caching), the retrieval of the users data is done in the action of your submit-button, anyway. Just iterate through the list and read out the `selectedValue. If the answer is usable/helpful, please consider an upvote, confirm if it worked out for you.
Hope it helps...

Combobox binding in silverlight Ria Services

I want to bind a combox with my entity model via domain services.
My entity model:
COUNTRIES (ID, NAME)
TABLE_TEST (PK_FIELD, FIELD2, COUNTRY_ID)
I created my entity model and the domain service.
My Xaml:
<riaControls:DomainDataSource AutoLoad="True" d:DesignData="{d:DesignInstance my:COUNTRIES, CreateList=true}" Height="0" Name="COUNTRIESDomainDataSource" QueryName="GetCOUNTRIESQuery" Width="0">
<riaControls:DomainDataSource.DomainContext>
<my:DomainService1 />
</riaControls:DomainDataSource.DomainContext>
</riaControls:DomainDataSource>
<riaControls:DomainDataSource AutoLoad="True" d:DesignData="{d:DesignInstance my:TABLE_TEST, CreateList=true}" Height="0" Name="TABLE_TESTDomainDataSource" QueryName="GetTABLE_TESTQuery" Width="0">
<riaControls:DomainDataSource.DomainContext>
<my:DomainService1 />
</riaControls:DomainDataSource.DomainContext>
</riaControls:DomainDataSource>
<ComboBox Name="COUNTRIESComboBox"
DataContext="{Binding ElementName=COUNTRIESDomainDataSource, Path=Data}" ItemsSource="{Binding}"
DisplayMemberPath="ID"
SelectedValuePath="NAME"
SelectedValue="{Binding ElementName=TABLE_TESTDomainDataSource, Path=COUNTRY_ID}">
</ComboBox>
The combobox is loaded with the correct values (all countries) but looks like it's not bounded with TABLE_TEST. When I change the register of TABLE_TEST, the value of the combo does not change.
What I am doing wrong? I looked many examples but no one is the same escenario, with domain data source and entity model.
I'm working with silverlight 5
Thanks
The DomainDataSource is an extremely bad fit as a datasource for Silverlight ComboBoxes. So far I've found Kyle McClennan's [MSFT] ComboBoxDataSource the most reliable in the use case you've described. In fact, he advised:
1) Do not use the DomainDataSource to populate ComboBoxes
You might
think this is drastic or an over reaction, but I stick by the
recommendation. Despite the simple samples you’ll see in other places,
I think you’re better off avoiding the DDS when working with
ComboBoxes. The DDS does not scale for more complex ComboBox
scenarios.
In particular, you need to mark your combobox as being Async in the final attribute.
<ComboBox Name="COUNTRIESComboBox"
DataContext="{Binding ElementName=COUNTRIESDomainDataSource, Path=Data}" ItemsSource="{Binding}"
DisplayMemberPath="ID"
SelectedValuePath="NAME"
SelectedValue="{Binding ElementName=TABLE_TESTDomainDataSource, Path=COUNTRY_ID}"
ex:ComboBox.Mode="Async">
</ComboBox>

Configuring a filter for Devexpress ASPxGridView

I have a column named Status that display an image corresponding to states. And I have a filter on this column. How can I localize?
<dx:GridViewDataImageColumn Caption="Status" FieldName="Status" Width="100px"
ShowInCustomizationForm="True" VisibleIndex="9">
<Settings AllowSort="True" SortMode="Value" AllowHeaderFilter="True" ShowInFilterControl="True" />
<HeaderStyle HorizontalAlign="Center" />
</dx:GridViewDataImageColumn>
I am not sure that I understand your task correctly. However, it seems that you need to use the gridView's HeaderFilterFillItems event to accomplish your task.

Telerik RadGrid - How to disable sorting for a Column?

In their documentation Telerik says that there is a way to disable sorting for specific column by using AllowSorting property. I'm looking at Telerik.Web.UI.GridColumn members and there is no AllowSorting property. There is a Sortable property but its protected and has to be overriden. So what do I use to turn off sorting for specific column?
There is a AllowSorting property on GridBoundColumn but in this case I'm using GridTemplateColumn. Is there a way to turn off sorting on GridTemplateColumn?
The AllowSorting attribute is available from the source/markup view in Visual Studio. For example (simplified):
<tr:RadGrid>
<MasterTableView>
<Columns>
<tr:GridBoundColumn DataField="field" HeaderText="Description"
AllowSorting="false" />
</Columns>
</MasterTableView>
</tr:RadGrid>
I don't know if this works for you? I haven't instantiated my grids from the code-behind files yet, so if that's what you are doing, I can't easily help you. But the above works for me.
EDIT:
Ah it was not clear from the original question, that you were using the GridTemplate column. As you are now using the SortExpression-property, doesn't using the same attribute in the markup work for you? So:
<tr:RadGrid>
<MasterTableView>
<Columns>
<tr:GridTemplateColumn HeaderText="Description" DataField="field"
SortExpression="">
<!-- template here etc. -->
</tr:GridTemplateColumn>
</Columns>
</MasterTableView>
</tr:RadGrid>
Okay, I got the desired effect, I turned off sorting by setting GridTemplateColumn's SortingExpression property to blank.
Grid.Columns.FindByUniqueName("Type").SortExpression = string.Empty;
This looks like a hack. Why isn't there an explicit property to turn off sorting? Oh well. This works.
If you know a better way, let me know.
Thanks.
Telerik now has a new property called HeaderButtonType (exists on a template column too!) which can be set to "None" to render a label instead of a linkbutton for the column header text.
As stated in the Telerik Docs:
In case you want to disable sorting for a particular column only, you can configure column's IsSortable property to False:
<telerik:GridViewColumn IsSortable="False" />
Here's an example showing how to disable sorting for a specific column.
Note the AllowSorting property at the Grid level (for all columns).
Then, in the Columns collection, note how it is turned off for that specific column.
<telerik:RadGrid ID="RadGrid1" runat="server" AllowSorting="True">
<HeaderContextMenu>
<CollapseAnimation Duration="200" Type="OutQuint" />
</HeaderContextMenu>
<MasterTableView>
<RowIndicatorColumn>
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn AllowSorting="False" UniqueName="column">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<FilterMenu>
<CollapseAnimation Duration="200" Type="OutQuint" />
</FilterMenu>
</telerik:RadGrid>
For TemplateColumns, I would try turning off Sorting at the grid level and simply enable it on the columns needed. That way, you won't have to do anything for the TemplateColumn since it will be disabled by default.
You could always supply your own headertemplate with a label as the header instead of a link button if you are using a GridTemplateColumn. A we bit extra work but this works fine. If you are going to disable sorting for all your GridTemplateColumns then your "hack" would be best.

Resources