How to design GridView to display with scrolling - microsoft-metro

How to design GridView in such a way that it display 3 images per row and can be scrolled up for the other Images behind? it seems this gridView displays images in a row.
Below I have 8 Pic in Gridview:
1) How to setup GridView to displays images with(3 images per row) or without specifying number of images per row and the rest will be viewed by scrolling up?
Thanks
< GridView HorizontalAlignment="Left" Margin="30,200,0,0" Grid.Row="1" VerticalAlignment="Top" Width="800" Height="400" >
//-- pic 1
< GridViewItem>
< Grid HorizontalAlignment="Left" Width="200" Height="200">
< Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}">
< Image Source="Images/M123.jpg" Tag="name" Tapped="Image_Tapped_1" Stretch="UniformToFill"/>
< /Border>
< StackPanel VerticalAlignment="Bottom" Background="{StaticResource ListViewItemOverlayBackgroundThemeBrush}">
< TextBlock FontSize="30" Text="name" Foreground="{StaticResource ListViewItemOverlayForegroundThemeBrush}"
Style="{StaticResource TitleTextStyle}" Height="40" Margin="15,10,15,0"/>
</StackPanel>
</Grid>
</GridViewItem>
//- pic 2 using GridViewItem
//-- pic 3 using GridViewItem
//--- Pic 3 to Pic 8 GridViewItem
< / GridView>

Put the grid view in a scrollviewer and let the height of the gridview be auto ie it will take the height of the entire content and width of the grid view to a specific one so that t cqn take only 3 items
next step is to just enable the vertical scroll property of the scroll viewer and disable the horizontal scroll property.
i hope this solves the purpose .

try to use jquery plugin
http://gridviewscroll.aspcity.idv.tw/
function gridviewScroll() {
$('#<%=gvMain.ClientID%>').gridviewScroll({
width: 700,
height: 330,
freezesize: 2,
arrowsize: 30,
varrowtopimg: "Images/arrowvt.png",
varrowbottomimg: "Images/arrowvb.png",
harrowleftimg: "Images/arrowhl.png",
harrowrightimg: "Images/arrowhr.png",
headerrowcount: 2
});
}

Related

How to auto-wrap if total html or component properties >= n?

As I understand with the default settings in vscode. The properties below will only auto-wrap when it reaches to the maxiumum wordWrapColumn. (See below)
<h1 className="sample" height="20" width="30" color="20" size="200" />
// auto separated
<h1
className="sample"
height="20"
width="30"
color="blue"
size="200"
/>
I wanna ask if its possible to change this behavior? Instead of basing to wordWrapColumn, we check the total properties of an element / component.
We auto-newline when it reaches to the specified total props.
totalHtmlProps = 3
## case 1
<h1 className="sample" height="20" />
## case 2
<h1
className="sample"
height="20"
color="blue"
/>
a quick update: i'm also using prettier with this.

Dynamically set color of line/spline in Nativescript-UI-Chart?

I need to match the color of each line in a chart to the color given by the object providing the data. The meter.color variable holds the color I need to use.
<StackLayout class="container" orientation="vertical">
<Label class="title" [text]="widget.settings.title" horizontalAlignment="center"></Label>
<RadCartesianChart class="chart" tkExampleTitle tkToggleNavButton>
<ng-container *ngFor="let meter of readings$ | async">
<ng-container [ngSwitch]="meter.type">
<LineSeries tkCartesianSeries seriesName="Line" *ngSwitchCase="'line'" [legendTitle]="meter.name + ' - ' + meter.unit"
[items]="meter.data" stackMode="Stack" categoryProperty="timestamp" valueProperty="value">
<Palette tkCartesianPalette seriesName="Line">
<PaletteEntry tkCartesianPaletteEntry [strokeColor]="meter.color"></PaletteEntry>
</Palette>
</LineSeries>
<SplineSeries tkCartesianSeries seriesName="Spline" *ngSwitchCase="'spline'" [legendTitle]="meter.name"
[items]="meter.data" stackMode="Stack" categoryProperty="timestamp" valueProperty="value">
<Palette tkCartesianPalette seriesName="Spline">
<PaletteEntry tkCartesianPaletteEntry [strokeColor]="meter.color"></PaletteEntry>
</Palette>
</SplineSeries>
</ng-container>
<RadLegendView tkCartesianLegend position="Top" title="Series" enableSelection="true"></RadLegendView>
<RadCartesianChartGrid tkCartesianGrid horizontalLinesVisible="true" verticalStrokeColor="#804d0026"></RadCartesianChartGrid>
<LinearAxis tkCartesianVerticalAxis horizontalLocation="Left" android:labelFormat="%.0f"></LinearAxis>
<DateTimeContinuousAxis tkCartesianHorizontalAxis dateFormat="hh:mm" [minimum]="backwardHour" [maximum]="forwardHour"
majorStep="Hour" labelFitMode="Rotate"></DateTimeContinuousAxis>
</ng-container>
</RadCartesianChart>
</StackLayout>
At the moment the line gets one color and the spline get another. But if i have more than two lines or splines all lines get the same color and all splines also get the same color. It seems that the last line added sets the color of both lines, the same goes for the spline.
I found a solution to my problem, i added property binding to seriesName on both the LineSeries and to the PaletteEntry witch matches each line dynamically to a ID.
Changes in my code:
<LineSeries tkCartesianSeries [seriesName]="meter.id" *ngSwitchCase="'line'" [legendTitle]="meter.name + ' - ' + register.unit" [items]="register.data" stackMode="Stack" categoryProperty="timestamp" valueProperty="value">
<Palette tkCartesianPalette [seriesName]="meter.id">
<PaletteEntry tkCartesianPaletteEntry [strokeColor]="meter.color"></PaletteEntry>
</Palette>
</LineSeries>

Heatbar, dynamic position offset of text

I want to insert a new column in my report to graphically display a "needle" displaying the position in a range of 0% - 100% like so:
I am looking for ideas please!
My idea
Use graphic (rainbow 0%-100% in every detail column).
Use a pixel offset (somehow??) where I simply place an overly large "|" type. So if 0%-100% are 200px that would mean that to display the needle at 50% I would offset the type 100px!
The easiest / most straightforward option I have found and implemented:
<image scaleImage="RetainShape" onErrorType="Blank">
<reportElement x="575" y="1" width="100" height="13" uuid="7cf54aff-65ac-40e5-8dc9-7f95d6f34d49"/>
<imageExpression>
<![CDATA[net.sf.jasperreports.renderers.BatikRenderer.getInstanceFromText("
<svg id=\"Layer_1\" data-name=\"Layer 1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"100\" height=\"13\" viewBox=\"0 0 100 13\">
<defs>
<linearGradient id=\"linear-gradient\" x1=\"-176.88\" y1=\"316.13\" x2=\"-150.45\" y2=\"316.13\" gradientTransform=\"matrix(3.78, 0, 0, -3.78, 689.01, 1202.56)\" gradientUnits=\"userSpaceOnUse\">
<stop offset=\"0\" stop-color=\"green\"/>
<stop offset=\"1\" stop-color=\"green\" stop-opacity=\"0\"/>
</linearGradient>
</defs>
<path d=\"M0,1.26H100v10.4H0Z\" style=\"fill: url(#linear-gradient)\"/>
<path d=\"M" + !!! OFFSET CALCULATION !!! + ",0V13\" style=\"fill: none;stroke: #000\"/>
</svg>
")]]></imageExpression>
</image>
Result:

Draw mysterious Pie Chart - wrong percentage in Slice

I am using Jaspersoft Studio and JasperReports Server, both in v.5.6.0.
I want to create a Pie Chart that shows the percentage of Errors colored in red.
Example:
$V{til_1} = total$V{state_1} = errors
total:2 - errors:1 => should result in a Pie Chart with 2 Slices -> 50% Red and 50% Green.
I used 2 Series, one Serie (Keyexpression) "green" (value 100.0), one Serie (Keyexpression) "red" (value: $V{state_1}>1?0:new Float(($V{state_1}*100)/$V{til_1}) ).
<pieChart>
<chart isShowLegend="false">
<reportElement x="293" y="0" width="30" height="30" uuid="8369e35a-d6d6-4e0d-aa6e-fef7a118ecce"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<pieDataset>
<pieSeries>
<keyExpression><![CDATA["green"]]></keyExpression>
<valueExpression><![CDATA[100.0]]></valueExpression>
<labelExpression><![CDATA[null]]></labelExpression>
</pieSeries>
<pieSeries>
<keyExpression><![CDATA["red"]]></keyExpression>
<valueExpression><![CDATA[$V{state_1}>1?0:new Float(($V{state_1}*100)/$V{til_1})]]></valueExpression>
<labelExpression><![CDATA[null]]></labelExpression>
</pieSeries>
</pieDataset>
<piePlot isShowLabels="false">
<plot>
<seriesColor seriesOrder="0" color="#99FF99"/>
<seriesColor seriesOrder="1" color="#CC0000"/>
</plot>
<itemLabel/>
</piePlot>
</pieChart>
Actual result (including the Problem):
However, when I run the report the calculation for "red" seams to be correct, the Chart output-image does not - link to image attached below. (50%red instead of 100% and 33,3%red instead of 50%)
Image:
Somebody knows where my mistake/how to get the right percentage in Pie Chart and -if possible- a short explanation why does jasper draw wrong chart-slices? Because of the two Series?
I believe that your problem is: the chart doesn't know what percentage is.
Actually, when you say to it "print serias A as 100" and "print series B as 50" it's going to assume 100% (the total, the full chart) is A + B, which is 150. Then, your series B will show as 33.3% of your total.
So basically, you will need to manually work out your "proportions". For example:
If you have "red" as $V{state_1} > 1 ? 0 : (new Float($V{state_1})/$V{til_1})*100, you can use your "green" as 100 - ($V{state_1} > 1 ? 0 : (new Float($V{state_1})/$V{til_1})*100).

removing extra space from top and left when using formitems in flex

I want to remove the extra space/padding/gap from FormItem I,m using in form for a mobile project in flex 4.6
I have tried making gap and padding to 0 but there the form and it's fields are still have indent to the right and top ?
<s:FormItem label="Start Date" width="150">
<s:HGroup>
<s:TextInput id="startDate" width="90" editable="false"/>
<s:Button id="setStartDate" label="set" height="34" fontSize="10" click="setStartDate_clickHandler(event)"/>
</s:HGroup>
</s:FormItem>
<s:FormItem label="End Date" width="150">
<s:HGroup>
<s:TextInput id="endDate" width="90" editable="false"/>
<s:Button id="setEndDate" label="set" height="34" fontSize="10" click="setEndDate_clickHandler(event)"/>
</s:HGroup>
</s:FormItem>
</s:HGroup>
</s:Form>
Gap between two form items, verticalGap.(set it on Form container)
Default hgroup gap is 6, set it to 0.
If gap between two items withn the FormItem, verticalGap (set this on the form container)
Form has FormHeading, set paddingTop=0 on this FormHeading comp. Also, try to set the height of this to 0 and PaddingTop = 0 on the form to reduce the gap btwn the first element and the top of the Form container.
This has good information about it http://livedocs.adobe.com/flex/3/html/help.html?content=layouts_08.html