I have a bar chart that is not accepting the padding that should be placed around the plotArea as specified.
The expectation is to have a graph that has a few pixels between the bars and the axis lines. Everything is set up and renders as expected except the padding.
Here is a fiddle of what I have so far
http://jsfiddle.net/itanex/KdfUv/
plotArea: {
background: "none",
padding: {
left: 2,
bottom: 2
}
},
The arrows point to the padding that I want to apply between the axis lines and the graph bars
Okay, the works, but not so as you expect:
http://jsfiddle.net/fool/KdfUv/7/
plotArea: {
background: "yellow",
padding: 10
},
Related
I am working with QML to try to display an image. I have the following code:
Rectangle {
id: border
anchors {
top: parent.top;
topMargin: vpx(20);
right: parent.right;
}
color: "black"
z: 6
width: 500
height: 750
Image {
id: picture
width: parent.width
height: parent.height
transformOrigin: Item.Center
rotation: (implicitWidth/implicitHeight > 1.3) ? 270 : 0
anchors.fill: border
fillMode: Image.PreserveAspectFit
source: ".../pic.png"
}
If rotation is set to 0, it scales correctly to fill the rectangle. If rotation is set to 270, it doesn't fill the rectangle - it rotates correctly, but it is well within the rectangle in both directions. It should have scaled up more.
Why is this happening?
EDIT: The code above has been edited. All of the above code is within a larger rectangle. The purpose of this code is to rotate images 90 degrees when they have a width > height. When rotation is set to 0 (i.e. height > width and no rotation needed), the picture displays as the first case below. When set to 270 (i.e. width > height, rotation needed), the picture displays as the second case below. I would like it to be comparable to the first picture, which fills the width, as I understand "fillMode: Image.PreserveAspectFit" should work.
black is rectangle, red is the image.
It is kind of tricky, but you can try this way:
Rectangle {
id: border
anchors {
top: parent.top;
right: parent.right;
}
color: "black"
z: 6
width: 500
height: 750
Item {
id: pictureItem
transformOrigin: Item.Center
rotation: (picture.implicitWidth/picture.implicitHeight > 1.3) ? 270 : 0
anchors.centerIn: parent
width: rotation == 270 ? parent.height : parent.width
height: rotation == 270 ? parent.width : parent.height
Image {
id: picture
anchors.fill: parent
fillMode: Image.PreserveAspectFit
source: ".../pic.png"
}
}
}
I have prepared two test images:
And this is what I get with above chunk of code:
When I use the chartarea of the Kendochart, it defines the size of the outer area and as result the legend of the chart doesn't show fully.
How can we set a fix size only for the pie chart and not the are that contains both the legend and the chart?
tried chartarea, css k-chart sizing or even .k-chart svn, padding, css width
1)
$("#chart").kendoChart({
chartArea: {
width: 200,
height: 200
},
....
this changes the area that also contains the legends and not only the chart
2)
<style>
.k-chart {
height: 250px;
width: 250px;
}
</style>
this resizes the area too
3)
seriesDefaults: {
labels: {
visible: false,
background: "transparent",
template: "#= category #: #= value#"
},
padding: 50
},
also tried using padding to seriesDeaults. This makes the charts smaller still when I have two same width divs with charts with different legends, their size is not the same. I need my charts to have the exact same size and position in the chartArea.
fix width of pie chart only
I'm currently trying to set up an image inside TouchableOpacity. It isn't showing and I'm stuck on why that is. Please let me know if you can help. TIA!
I've basically copied this: https://facebook.github.io/react-native/docs/touchableopacity from the official docs, but to no avail.
Thought maybe my TouchableOpacity element wasn't full screen but that's not the case (when I set the background color, I see it fill the screen).
<TouchableOpacity style={styles.button} onPress={this.onWaitingButtonPress.bind(this)}>
<Image style={styles.imagestyle} source={{uri: "https://www.dollargeneral.com/media/catalog/product/cache/image/e9c3970ab036de70892d86c6d221abfe/0/0/00870101.jpg"}}/>
</TouchableOpacity>
const styles = {
button: {
flex: 1,
alignItems: "stretch",
backgroundColor: "red"
},
imageStyle: {
flex: 1,
resizeMode: "contain"
}
};
I get the red background to fill the whole screen, but the image does not.
flex: 1 cover the entire width and height of its container. probably your view's dimensions are 0.
if your touchable is showing, try this;
imageStyle: {
width: "100%",
height: "100%"
}
if it's not;
button: {
width: 100,
height: 100
}
or,
button: {
width: "100%,
height: "100%"
}
so, you can understand the difference between them when trying these
Flex:1 in parent covers entire area but flex1 in image cover only height of entire screen. Here width becomes 0 since flex direction is column by default. Try setting some width lfor image ike "100%' 0r any other value.
Edited after the comment:
If it doesn't not work then add width to touchableopacity also
I'd like to be able to bottom align an image using Image or ImageBackground, but have been unsuccessful in doing so.
<View style={styles.moduleHeader}>
<ImageBackground
style={styles.image}
source={{ uri: image }}
resizeMode="cover">
<Text>text</Text>
</ImageBackground>
</View>
moduleHeader: {
height: 200,
},
image: {
width: Layout.viewport.width, //device width
height: 200,
position: "absolute",
bottom: 0,
},
Other attempts include negative top margin and padding.
I've also messed around with aspect ratio, but that needs to be more of a precise number, and I don't need that level of precision.
The inclusion of absolute and bottom have no effect that I can tell...
Basically Id like to mimic the effect background-position: center bottom; has in CSS.
I don't mind if the image is cropped horizontally, just that the bottom of the image is aligned with the bottom of the container.
I haven't been able to find with any certainty that this is even possible in React-Native, so confirmation of that theory would constitute a correct answer.
As always any and all direction is greatly appreciated so thanks in advance!
You need to remove position and bottom tag from ImageBackground style and add into style of View
Something like this
moduleHeader: {
height: 200,
width:'100%',
position: "absolute",
bottom: 0,
},
image: {
width:'100%', //device width
height: 200,
backgroundColor:"#000",
},
Please check this snack expo code
https://snack.expo.io/#vishal7008/again-bottom-ui
I am trying to get the my Kendo UI Chart title positioned to the right of the chart. Is this possible? I see in the docs it says "top" or "bottom" but has anyone figured out a way to put the titles to the right of the chart?
This is not a good solution, but you cat do it through padding:
title: {
text: "Title",
padding: {
top: 10,
left: -100
}}