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

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.

Related

URDF model keeps disappearing whenever I add intertial properties to a link? How can I resolve this issue?

I am trying to simulate a simple pendulum using pydrake and am having a couple of issues creating the urdf file to creat the model for the pendulum. I have no background knowledge on urdf or drake and am open to any suggestions to resolve this issue.
This is the code I have so far:
import os
from tempfile import mkdtemp
from pydrake.all import (
AddMultibodyPlantSceneGraph,
DiagramBuilder,
Meshcat,
MeshcatVisualizerCpp,
Parser,
Simulator,
)
from manipulation.meshcat_cpp_utils import (
StartMeshcat, MeshcatJointSlidersThatPublish)
# Start the visualizer.
meshcat = StartMeshcat()
tmp_dir = mkdtemp()
model_file = os.path.join(tmp_dir, "test_model.urdf")
model_text = f"""\
<?xml version="1.0"?>
<robot name="materials">
<material name="blue">
<color rgba="0 0 0.8 1"/>
</material>
<material name="white">
<color rgba="1 1 1 1"/>
</material>
<material name="green">
<color rgba="0.0 0.8 0.0 1.0"/>
</material>
<link name="base">
<visual>
<geometry>
<box size="0.5 0.5 0.1"/>
</geometry>
</visual>
<inertial>
<mass value="1"/>
</inertial>
</link>
<joint name="world_2_base" type="fixed">
<parent link="world"/>
<child link="base"/>
<origin xyz="0 0 0.5"/>
</joint>
<link name="arm">
<visual>
<geometry>
<cylinder length="0.5" radius="0.01"/>
</geometry>
<material name="blue"/>
</visual>
</link>
<joint name="base" type="revolute">
<parent link="base"/>
<child link="arm"/>
<axis xyz="1 0 0"/>
<origin xyz="0 0 -0.3"/>
</joint>
<link name="ball">
<visual>
<geometry>
<sphere radius="0.1"/>
</geometry>
<material name="green"/>
</visual>
</link>
<joint name="base2" type="fixed">
<parent link="arm"/>
<child link="ball"/>
<origin xyz="0 0 -0.35"/>
</joint>
</robot>
"""
# Write temporary file.
with open(model_file, "w") as f:
f.write(model_text)
builder = DiagramBuilder()
plant, scene_graph = AddMultibodyPlantSceneGraph(builder, time_step=0.0)
# Add pendulum model.
model = Parser(plant, scene_graph).AddModelFromFile(model_file)
# - Weld base at origin.
base_link = plant.GetBodyByName("base", model)
#plant.WeldFrames(plant.world_frame(), base_link.body_frame())
plant.Finalize()
visualizer = MeshcatVisualizerCpp.AddToBuilder(builder, scene_graph, meshcat)
diagram = builder.Build()
simulator = Simulator(diagram)
simulator.set_target_realtime_rate(1.0)
simulator.AdvanceTo(5.0)
This code gives me a blanck meshcat screen. But when I remove the inertia tags in the base link I can see a model of the pendulum. Please let me know what I am doing wrong. Also if you can reccomend some resources to learn about urdf and drake that would be really helpful.
Thank you very much.
I believe that the problem is that you have no mass in the arm, so when you go to simulate it, the simulation is ill-defined (probably you get NaNs in the state variables).
If you want to check just the visualization, I'd recommend doing
context = diagram.CreateDefaultContext()
diagram.Publish(context)
instead of the simulator step.
I have started working on a proper tutorial for precisely this. It's very much a draft right now, but in case it helps you can find it here. I intend for this to be one of the real Drake tutorials soon.

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:

Jasper Ireport Alternate row colors with custom style

I've add a conditionnal style to my report for alternate row style like this :
<style name="tab_page_4">
<conditionalStyle>
<conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 1]]></conditionExpression>
<style forecolor="#FFFFFF" backcolor="#E7ECF4"/>
</conditionalStyle>
</style>
<reportElement key="textField" style="tab_page_4" mode="Opaque" x="11" y="5" width="94" height="15" forecolor="#00597C" backcolor="#FFFFFF" uuid="4ea6f9a0-d1c8-42f0-8ae4-7c9780fcfe3d"/>
When i generate my report, the custom style doesnt work.
What i've forgot ?
When using conditional styles, it is important to remove all style data in the element. This means that in this case the elements mode, forecolor and backcolor should be removed so that the style is used.
It is possible to set e.g. the forecolor on an element when using a conditional to set the forecolor explicitly for this element. But usually all coloring will happen with the conditional style.
EDIT
As Alex K pointed out, make sure the conditional style also sets mode="Opaque":
<style name="tab_page_4" mode="Opaque">
....
</style>
Or if using conditional styles:
<conditionalStyle>
<conditionExpression>...</conditionExpression>
<style mode="Opaque" .../>
</conditionalStyle>
I resolve a bug by following the notes of #Alex K and #Tobi6
The code of my ireport is now like this :
<style name="tab_page_4">
<conditionalStyle>
<conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 1]]></conditionExpression>
<style mode="Opaque" forecolor="#00597C" backcolor="#E7ECF4"/>
</conditionalStyle>
<conditionalStyle>
<conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 0]]></conditionExpression>
<style mode="Opaque" forecolor="#00597C" backcolor="#FFFFFF"/>
</conditionalStyle>
</style>
And in my element :
<reportElement key="textField" style="tab_page_4" x="0" y="0" width="105" height="25" uuid="4ea6f9a0-d1c8-42f0-8ae4-7c9780fcfe3d"/>

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

iReport displays too many labels on x axis

Good morning! I'm having a problem with Jaspersoft iReport 4.5.0, and I was hoping for some help. Basically, when I display an xy line chart, it's attempting to add a label on the x-axis for each data point. I have almost 200 data points, so this ends up looking like just a solid line, even if I tweak the rotation of the tick labels or whatever.
I'm aware that the general response to this question is to use a timeseries chart instead. This would ordinarily work, but in my instance I am using a multi-axis chart where the opposite axis is a bar chart. Since a bar chart has no timeseries variety, iReport will not allow me to mix a bar chart with a timeseries chart, forcing me to use the xy line chart.
Is there any way I can have my cake and eat it, too? Some way I can filter out some of the labels? Or perhaps limit the number of labels that can be displayed, spread out over the x-axis? I have yet to see a definitive answer anywhere on the internet!
Thanks in advance!
- Ian
EDIT: Here is the jrxml for one of the multi-axis charts I'd like to modify:
<multiAxisChart>
<chart evaluationTime="Report" hyperlinkType="LocalAnchor">
<reportElement x="42" y="441" width="440" height="292"/>
<chartTitle position="Top">
<titleExpression><![CDATA["CICS Elapsed"]]></titleExpression>
</chartTitle>
<chartSubtitle/>
<chartLegend/>
<anchorNameExpression><![CDATA["CICS Elapsed Small"]]></anchorNameExpression>
<hyperlinkAnchorExpression><![CDATA["CICS Elapsed Big"]]></hyperlinkAnchorExpression>
<hyperlinkTooltipExpression><![CDATA["Click to Enlarge"]]></hyperlinkTooltipExpression>
</chart>
<multiAxisPlot>
<plot/>
<axis position="leftOrTop">
<lineChart>
<chart>
<reportElement x="0" y="0" width="0" height="0" backcolor="#FFFFFF"/>
<chartTitle position="Top" color="#000000">
<titleExpression><![CDATA["CICS Elapsed"]]></titleExpression>
</chartTitle>
<chartSubtitle color="#000000"/>
<chartLegend textColor="#000000" backgroundColor="#FFFFFF"/>
</chart>
<categoryDataset>
<dataset>
<datasetRun subDataset="wmprod_cics"/>
</dataset>
<categorySeries>
<seriesExpression><![CDATA["Cpu Time"]]></seriesExpression>
<categoryExpression><![CDATA[$F{TIMESTAMP}]]></categoryExpression>
<valueExpression><![CDATA[$F{ELAPSTIME}]]></valueExpression>
</categorySeries>
</categoryDataset>
<linePlot isShowShapes="false">
<plot/>
<categoryAxisLabelExpression><![CDATA["Date/Time"]]></categoryAxisLabelExpression>
<valueAxisLabelExpression><![CDATA["Avg Elapsed Time (ms)"]]></valueAxisLabelExpression>
</linePlot>
</lineChart>
</axis>
<axis position="rightOrBottom">
<barChart>
<chart>
<reportElement x="0" y="0" width="0" height="0" backcolor="#FFFFFF"/>
<chartTitle position="Top" color="#000000">
<titleExpression><![CDATA["CICS Elapsed"]]></titleExpression>
</chartTitle>
<chartSubtitle color="#000000"/>
<chartLegend textColor="#000000" backgroundColor="#FFFFFF"/>
</chart>
<categoryDataset>
<dataset>
<datasetRun subDataset="wmprod_cics"/>
</dataset>
<categorySeries>
<seriesExpression><![CDATA["Volume (transactions)"]]></seriesExpression>
<categoryExpression><![CDATA[$F{TIMESTAMP}]]></categoryExpression>
<valueExpression><![CDATA[$F{TRANSCOMPL}]]></valueExpression>
</categorySeries>
</categoryDataset>
<barPlot>
<plot/>
<itemLabel/>
<valueAxisLabelExpression><![CDATA["Volume (transactions)"]]></valueAxisLabelExpression>
</barPlot>
</barChart>
</axis>
</multiAxisPlot>
</multiAxisChart>
I had the same problem. I think the answer is this:
<chart>
<reportElement x="0" y="0" width="802" height="215">
<property name="net.sf.jasperreports.chart.domain.axis.tick.interval" value="1"/>
</reportElement>
Set the tick interval as appropriate. Note: My chart was a scatter chart. Untested with line chart.