Two LineSeries with the same Y Axis in WPF Toolkit charts - charts

I want to do the following with the WPF toolkit charts:
I have two line series that should use the same y axis (i.e I want them both to be on the same scale). I could give each of them the same axis definition so they would overlap (and then have one of them with collapsed visibility), but that is not my best choice.
This is the solution I'm talking about:
<charts:LineSeries Name="ExternalMeasureSeries"
IndependentValueBinding="{Binding Time}"
DependentValueBinding="{Binding ExternalMeasure}">
<charts:LineSeries.DataPointStyle>
<Style TargetType="charts:LineDataPoint">
<Setter Property="Background" Value="Red"/>
<Setter Property="Opacity" Value="0" />
</Style>
</charts:LineSeries.DataPointStyle>
<!-- Vertical axis for external measure curve -->
<charts:LineSeries.DependentRangeAxis>
<charts:LinearAxis
Orientation="Y"
Title="Measurement"
Minimum="0"
Maximum="30"/>
</charts:LineSeries.DependentRangeAxis>
</charts:LineSeries>
<charts:LineSeries Name="InternalMeasureSeries"
IndependentValueBinding="{Binding Time}"
DependentValueBinding="{Binding InternalMeasure}">
<charts:LineSeries.DataPointStyle>
<Style TargetType="charts:LineDataPoint">
<Setter Property="Background" Value="Orange"/>
<Setter Property="Opacity" Value="0" />
</Style>
</charts:LineSeries.DataPointStyle>
<!-- Vertical axis for internal measure curve -->
<charts:LineSeries.DependentRangeAxis>
<charts:LinearAxis
Orientation="Y"
Minimum="0"
Maximum="30"
Visibility="Collapsed"/>
</charts:LineSeries.DependentRangeAxis>
</charts:LineSeries>
Is there a way to define more than one series with the same Y axis?
I found that toolkit version 3.5.0.0 has something called StackedLineSeries but that version 3.5.40128.1 which is what gets installed in the February 2010 version of the toolkit, it isn't there. Did it move to another clr-namespace?

I faced the same issue and found the following way around. You can add the two series to the same chart and hide the second series Axis label by setting the Width to 0;
<charts:LinearAxis
Orientation="Y"
Title="Measurement"
Minimum="0"
Maximum="30"
**Width = "0"**
/>
Hope this helps

I have a chart with 3 line series. The first 2 series represent the relative humidity and the third one represent the dew point.
I want to draw the first 2 series on the same Y axis. I created my axes in a resource section. In my example, this is in a TabItem.
<TabItem Header="rH">
<TabItem.Resources>
<chartingToolkit:LinearAxis Orientation="Y" HorizontalAlignment="Left" Title="rH /%" x:Key="RHYAxis" />
<chartingToolkit:LinearAxis Orientation="Y" HorizontalAlignment="Right" Title="Dew point /°C" x:Key="DewPointYAxis" />
</TabItem.Resources>
<chartingToolkit:Chart HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Title="Relative Humidity" IsEnabled="True">
<chartingToolkit:Chart.Series>
<chartingToolkit:LineSeries DependentRangeAxis="{StaticResource RHYAxis}" IsSelectionEnabled="False" ItemsSource="{Binding Path=RHCollection}" IndependentValuePath="TimeStamp" DependentValuePath="rH" Title="Measured rH" />
<chartingToolkit:LineSeries DependentRangeAxis="{StaticResource RHYAxis}" IsSelectionEnabled="False" ItemsSource="{Binding Path=CorrectedRHCollection}" IndependentValuePath="TimeStamp" DependentValuePath="CorrectedRH" Title="Corrected rH" />
<chartingToolkit:LineSeries DependentRangeAxis="{StaticResource DewPointYAxis}" IsSelectionEnabled="False" ItemsSource="{Binding Path=DewPointCollection}" IndependentValuePath="TimeStamp" DependentValuePath="DewPoint" Title="Dew point" />
</chartingToolkit:Chart.Series>
</chartingToolkit:Chart>

Related

.NET MAUI How to set CollectionView items Padding to 0

I can't set padding to 0 in items of CollectionView in MAUI.
In this example, I use Data and Data[i].Color as follow:
<CollectionView
ItemsSource="{Binding Data}"
ItemSizingStrategy="MeasureFirstItem"
ItemsLayout="HorizontalList">
<CollectionView.ItemTemplate>
<DataTemplate>
<Button
Clicked="Button_Clicked"
WidthRequest="10"
HeightRequest="10"
BackgroundColor="{Binding Color}" />
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
My Buttons has Width 10 and Height 10, and there is space between my Buttons. Only set Button Width more than 100 can I see no space between my Buttons, but 100 is too large.
I tried to set Padding or Margin in Button, and WidthRequest in CollectionView, but it didn't work.
How can I remove the space?
I tried ItemSpacing:
<CollectionView.ItemsLayout>
<LinearItemsLayout
Orientation="horizonal"
ItemSpacing="0" />
</CollectionView.ItemsLayout>
But fail.
You want to set the space between buttons to 0 in CollectionView. And this is a known issue and it's been tracked in Windows CollectionView ItemSpacing is not working. When setting the property ItemSpacing to 0, the space between the items should have been reduced to 0, however it doesn't work as expected.
For more details, you can refer to MAUI: How to reduce spacing between buttons.

Adjusting CFWindow position on the screen, is it possible?

I try to use cfwindow to deliver an error/warning message to my users. It works but the only problem is the pop up window is off the screen all the way to the bottom sinking to the task bar.
I thought I can use the x and y attributes but I tried them and they did not work.
Is it possible to adjust the positioning of cfwindow at all so when it shows up it will be in the middle of the screen or at least in the middle up instead of sinking down below?
<CFTRY>
<cffile action="upload" filefield="uploadfile" destination="#TempDestination#" nameConflict="overwrite" result="myupload">
<cfdump var="#myupload#">
<CFCATCH type="Any">
<cfwindow initShow="true" title="Minute Upload Problem" center="true" height="200" width="400"
x="880" y="850"
bodyStyle="font-family: verdana; color: ##000000; font-size: 13;"
headerStyle="font-family: verdana; background-color: ##ff0000; color: ##ffffff"
resizable="False" name="NoPermission">
<!--- message --->
<div align="center">
Destination Folder may not be set to accept your file<br>
Please contact the webmaster.
</div>
</cfwindow>
</CFCATCH>
</CFTRY>
To fit the window as per x & y coordinates, you will have to set
center="false"
If center is set to true, then it will take precedence over the x & y coordinates. I have set center="false". Now, the position of the new popup windows changes, as I change the x & y coordinates.

TYPO3 Fluid: f:image trim image then scale

I have a square image of 1200x1200px. Now I want to cut off / trim all sides by 80px and then scale it down to 275px. How is this possible?
<f:image src="path/to/image.jpg" width="275c" />
This just scales down the image, so I took a look at the imgResource Core Documentation that told me, you can crop images by substracting x percent.
<f:image src="path/to/image.jpg" width="1120c-93" height="1120c-93" />
93% of 1200px are roughly 1120px.
Next try was to first crop, then scale, but it seems that I'm not able to trim a square image at all.
<f:image src="{f:uri.image(src: 'path/to/image.jpg', width: '1200c-93')}" width="275" />
Does anyone have any suggestions how to solve the problem?
Edit
So I tried the following with fixed width and height:
<f:image src="{f:uri.image(src: '{item.imagePath}image_001.jpg', width: '1120c-50', height: '1120c-50')}" width="275" height="275" alt="{item.name}" />
<f:image src="{item.imagePath}image_001.jpg" alt="{item.name}" width="275" alt="{item.name}" />
But this gives me two identical images: http://img545.imageshack.us/img545/204/nsuo.png
You have to specify an explicit height in the inner call and the crop values must be smaller than the original image size. So try this one:
<f:image src="{f:uri.image(src: 'path/to/image.jpg', width: '1120c-93', height: '1120c-93')}" width="275" alt="" />

Using variables in Conditional Style

I have a Title band with a Text Field containing a calculated Variable $V{avg_perc}. The Text Field has the evaluationTime set to Report, same for the Variables resetType.
Now I'm trying to set the background color of this field with a Conditional Style but I keep getting an error message saying something like:
Invalid expression: !Double.isNaN($V{avg_perc}) && $V{avg_perc} >= 0.8
I'm doing exactly the same thing with the same Conditional Style in the Column Footer and it works without any problems, even if I set the evaluationTime for this field to Report too.
After removing !Double.isNaN($V{avg_perc}) I don't get an error anymore but the expression still doesn't work. My field stays red which is the basic color when none of the conditions is valid, no matter which value $V{avg_perc} has. It still works in the Column Footer, though. This is my style:
<style name="avg_color" mode="Opaque" backcolor="#FF0000" pdfFontName="Helvetica-Bold">
<conditionalStyle>
<conditionExpression><![CDATA[$V{avg_perc} >= 0.8]]></conditionExpression>
<style backcolor="#008000"/>
</conditionalStyle>
<conditionalStyle>
<conditionExpression><![CDATA[$V{avg_perc} >= 0.6 && $V{avg_perc} < 0.8]]></conditionExpression>
<style backcolor="#FFCC00"/>
</conditionalStyle>
</style>
Used Fields and Variables for this:
<field name="perc" class="java.lang.Double"/>
<variable name="avg_perc" class="java.lang.Double" calculation="Average">
<variableExpression><![CDATA[$F{perc}]]></variableExpression>
</variable>
Any idea how to get this thing to work? I'm using JasperReports and iReport in version 3.7.4.
I finally found the solution for my problem. Adding
<property name="net.sf.jasperreports.style.evaluation.time.enabled" value="true"/>
at the report level causes a Conditional Style to be performed at the moment at which the element is evaluated.
See this answer in the Jaspersoft Community for more information.
in your view ireport designer.
click on the field and in the properties panel.: markup = styled selected
Right click on the fied. edit expression:
($F{fila1}.equals("c") ? "<style forecolor='red'>"+ $F{fila1}+"</style>" : $F{fila1})
or xml
<textFieldExpression><![CDATA[($F{fila1}.equals("c") ? "<style forecolor='red'>"+ $F{fila1}+"</style>" : $F{fila1})]]></textFieldExpression>
Modify this code based on your requirement
<style name="alternateStyle" fontName="Arial">
<conditionalStyle>
<conditionExpression><![CDATA[new Boolean($V{AMOUNT}.intValue() == 0)]]></conditionExpression>
<style mode="Opaque" backcolor="#FF0000" isBold="true"/>
</conditionalStyle>
</style>
And also refer this link : Link

WPF toolkit charting Lineseries styling

Is it possible to change the thickness of the LineSeries?
Is it possible to show LineSeries as dashed lines?
I have othe question about AreaSeries, no matter what all my Area Series are drawing from x-Axis. What I want is that I can draw let say a area for these four point (2,2), (2,6), (8,6), (8,2).
How can I manage it?
For setting the thickness and dashed line style of a LineSeries, use a Style like the one shown here:
<Window.Resources>
<Style x:Key="DashedPolyLine" TargetType="{x:Type Polyline}">
<Setter Property="Stroke" Value="Red" />
<Setter Property="Width" Value="3" />
<Setter Property="StrokeDashArray" Value="4, 2" />
</Style>
</Window.Resources>
.
.
.
<charting:LineSeries
ItemsSource="{Binding MyItems}"
IndependentValuePath="myIndValue"
DependentValuePath="myDepValue"
PolylineStyle="{StaticResource DashedPolyLine}"
</charting:LineSeries>