Display static text/picture on X3D/X3DOM - x3d

What is a correct way to display a static text or picture in X3D/X3DOM? Using HTML elements really easy screw up the format of the entire website...

You can use ImageTexture
Example:
<x3d width='500px' height='400px'>
<scene>
<shape>
<appearance>
<ImageTexture url="myTexture.png"><ImageTexture/>
</appearance>
<box> </box>
</shape>
</scene>
</x3d>
And for static text you can use the Text node.

Related

How to change Legend text colors in recharts

I'm trying to change text Legend colors in recharts
By default, legend takes colors based on lines/bars :
And I want :
Seems like what I want was the previous default setting, because doc explain us how to have colorful legend texts : https://codesandbox.io/s/legend-formatter-rmzp9
https://recharts.org/en-US/api/Legend
I can't find how to do the reverse
Ran into the same issue, solution is to the use the formatter:
<Legend
formatter={(value, entry, index) => <span className="text-color-class">{value}</span>}
/>
The span returned from this function only renders in place of the text portion of the legend, the coloured shapes (circles in your example) aren't effected.
You can change the stroke prop of both Line components as follows. Codesandbox example given here.
stroke="#FF0000" refers to red color and stroke="#000000" refers to black color.
<Line
type="monotone"
dataKey="pv"
stroke="#FF0000"
activeDot={{ r: 8 }}
/>
<Line type="monotone" dataKey="uv" stroke="#000000" />
Hope this would answer your question.

how to add extra information in the point/hoverover tooltip

I am using recharts in my project. The chart that I'm using is CustomizedLabelLineChart. My problem is that the values that I'm using for X-axis are too long, so I need to kinda remove them from the X-axis but still have them in the chart-hoverover tooltip. How to do that? In other words, I need to have some extra data added to each point/hoverover tooltip.
You can create a custom tooltip component and pass it as the prop called content in , here is an example with custom tooltip called
<CustomizedLabelLineChart width={600} height={300} data={data}>
<XAxis dataKey="name" tick={<CustomAxisTick />} />
<YAxis />
<Tooltip content={<CustomTooltip />}/>
...
</CustomizedLabelLineChart>
Reference: http://recharts.org/en-US/guide/customize

X3Dom set ImageTexture in Text

I have this code and it doesn't work. How can I fix it?
And how can I change the size of text?
<x3d width='800px' height='400px'>
<scene>
<shape>
<Appearance>
<ImageTexture url='1.jpg'/>
</Appearance>
<Text string='3'>
<FontStyle style='BOLD' />
</Text>
</shape>
</scene>
You cannot set a font size on a ImageTexture. Anyways, here's an example of creating a textured cube (Box) and putting a Text shape in front of it.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "http://www.web3d.org/specifications/x3d-3.0.dtd">
<X3D>
<Scene>
<Group>
<Transform>
<Shape>
<Appearance>
<ImageTexture url='1.jpg'/>
</Appearance>
<Box/>
</Shape>
<Transform translation="0 0 1">
<Shape>
<Appearance>
<Material/>
</Appearance>
<Text string='"This is a text"'>
<FontStyle family='"SANS"' justify='"MIDDLE"' size="1.5" style="BOLD"/>
</Text>
</Shape>
</Transform>
</Transform>
</Group>
</Scene>
</X3D>

Not able to show image on dialog box in AEM

I am trying to create a dialog with image preview on it. I am able to create dialog with all the fields but i am facing issue with image. I have seen the image component where you can drag drop image but i need the image to be shown when i open dialog component. Is there any component for this without drag drop.
I have tried with html5smartimage image but not working. Please see code below:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="cq:Dialog"
height="{Long}500"
title="Test Dialog"
width="{Long}800"
xtype="dialog">
<items
jcr:primaryType="cq:Widget"
xtype="tabpanel">
<items jcr:primaryType="cq:WidgetCollection">
<tab1
jcr:primaryType="cq:Panel"
title="Component Details">
<items jcr:primaryType="cq:WidgetCollection">
<image
jcr:primaryType="cq:Widget"
cropParameter="./imageCrop"
ddGroups="[media]"
fileNameParameter="./fileName"
fileReferenceParameter="./fileReference"
mapParameter="./imageMap"
name="./file"
requestSuffix=".img.png"
rotateParameter="./imageRotate"
title="Image"
xtype="html5smartimage">
<icon.png jcr:primaryType="nt:file">
<jcr:content
jcr:data="{Binary}"
jcr:lastModified="{Date}2015-07-28T19:27:46.878+05:30"
jcr:lastModifiedBy="admin"
jcr:mimeType="image/png"
jcr:primaryType="nt:resource"
jcr:uuid="754c14c8-4423-45df-b982-06bfc13dc6e3"/>
</icon.png>
</image>
</items>
</tab1>
</items>
</items>
</jcr:root>
Please help me out on this.
I don't think there is a need to use the html5smartimage if all that you want to do is, display a static image in the dialog (which needn't get submitted too).
You can make use of the xtype displayfield and use the html property as shown below.
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="cq:Dialog"
height="{Long}500"
title="Test Dialog"
width="{Long}800"
xtype="dialog">
<items
jcr:primaryType="cq:Widget"
xtype="tabpanel">
<items jcr:primaryType="cq:WidgetCollection">
<tab1
jcr:primaryType="cq:Panel"
title="Component Details">
<items jcr:primaryType="cq:WidgetCollection">
<displayimage jcr:primaryType="cq:Widget"
html="<img src='/content/dam/geometrixx/icons/target.png'>"
xtype="displayfield" />
</items>
</tab1>
</items>
</items>
</jcr:root>
Replace the image src with the path to your image which you want to display in the dialog.

Hide reorder button in a multifield

I have a dialog with a multifield with custom xtype. As per the requirement, I don't require the re-ordering functionality of the multifield elements. Is there a way to hide these buttons.
Dialog xml is as follows.
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="cq:Dialog"
height="{Long}800"
width="{Long}1200"
xtype="dialog">
<items
jcr:primaryType="cq:Widget"
xtype="tabpanel">
<items jcr:primaryType="cq:WidgetCollection">
<tabs
jcr:primaryType="cq:Panel"
title="Questions & Answers">
<items jcr:primaryType="cq:WidgetCollection">
<tabs
jcr:primaryType="cq:Widget"
addItemLabel="Add a question"
fieldDescription="Note:
1. Add the questions first in a row.
2. Please select answer type before start adding the answers."
name="./questionStack"
xtype="multifield">
<fieldConfig
jcr:primaryType="nt:unstructured"
xtype="apps.nirmal.widgets.configurableQandAfield"/>
</tabs>
</items>
</tabs>
</items>
</items>
</jcr:root>
Just check the API documentation at https://docs.adobe.com/docs/en/cq/5-6/widgets-api/index.html
There you see a boolean property in the Multifield configuration properties to disable ordering:
orderable : Boolean
If the list of fields should be orderable and Up/Down buttons are
rendered (defaults to true).

Resources