angular-nvd3 margin doesn't work? (krispo) - angular-nvd3

No matter how much I change the margin. The dates get cut off. I am trying to show a 7 date range, but the last date gets cut off. Any ideas, to work around this?
My code:
vm.lineChartOptions = {
chart: {
type: 'lineChart',
height: 450,
tickPadding: 25,
margin: {
top: 50,
right: 1000,
bottom: 60,
left: 1000
}
}

There's a property in the xAxis object, and I had the showMaxMin: set to false, and changed it to true. I also realized my gulp wasn't running for about an hour so there's that.
After I set to showMaxMin to true, and booted my gulp up again, I was able to change the margin.

Related

How to specify a size for google pie charts?

I'm having trouble changing the size of a google pie chart that I have made. I'm trying to draw multiple pie charts with the size of each chart proportional to the total amount of data that I'm feeding it. I am aware that we are able to change the size of the div container of the chart by adding options to the chart like as follows:
var options = {width: 400, height: 300};
However, what I'm interested in, is not changing the size of the div, but of the actual pie chart itself.
Is there any way I can change the radius of the pie chart?
I've searched around and wasn't able to find anything. Here is quick paint of what I mean:
As you can see, what I would like is for the div to remain on the same size but the size of the circle to change, depending on what value I feed it.
Any help is appreciated
try the option for chartArea
e.g.
chartArea: {width: 400, height: 300}
Try the example as below
http://jsfiddle.net/toddlevy/c59HH/
function initChart() {
var options = {
legend:'none',
width: '100%',
height: '100%',
pieSliceText: 'percentage',
colors: ['#0598d8', '#f97263'],
chartArea: {
left: "3%",
top: "3%",
height: "94%",
width: "94%"
}
};

Why does this window show up as shorter than what was set?

I am creating an app window like this:
var screenWidth = screen.availWidth;
var screenHeight = screen.availHeight;
//Create the app window
chrome.app.window.create(
'test.html',
{
frame: "none",
bounds:
{
width: 700,
height: 600,
left: Math.round((screenWidth-width)/2),
top: Math.round((screenHeight-height)/2)
},
maxWidth: 700,
maxHeight: 600,
resizable: false,
id: "test"
}
);
but it shows on screen as only 591 pixels tall!
When I view the HTML/CSS in Chrome as a local HTML page, it shows as the proper height of 600 pixels tall. Why does creating it as a window make it 9 pixels too short?
It was caching the size I had set the window to in a previous version and not allowing that to be changed via the create method. The only fix I found was to do:
function(myWin)
{
myWin.moveTo( Math.round((screenWidth-width)/2), Math.round((screenHeight-height)/2) );
myWin.resizeTo( 700, 600 );
}
in the callback for the create method

Titanium button not changing background color when selected

I have a newbie question: A simple button I've created in Titanium for iPhone refuses to change colors when clicked. Originally I used a button for this function; since it didn't work, I changed to a View, but neither works. Here it how it is set up:
var quifButton = Ti.UI.createView({ // tried this with createButton, as well
top: 44, left: 5, width: 310, height: 42,
backgroundColor: '#333',
backgroundSelectedColor: '#fff',
backgroundFocusedColor: '#fff',
touchEnabled: true,
borderColor: BOR_DK, borderWidth: 2, borderRadius: 5 });
When I click the Button / View in the iPhone simulator, nothing happens. Any ideas why this doesn't work and how I can make it work?
Click is not same than focus. If you want to change color on click, you have to add eventlistener to button or view.
quifButton.addEventListener('click', function(e){
quifButton.backgroundColor = '#fff';
});
*Edit:
backgroundSelectedColor: '#fff',
backgroundFocusedColor: '#fff',
These are not supported in iOS.
This is a limitation in iOS, and is not related to Titanium.
Try this instead for the behaviour you're looking for:
someBtn.addEventListener('touchstart', function() {
someBtn.backgroundColor = 'green';
});
someBtn.addEventListener('touchend', function() {
someBtn.backgroundColor ='blue';
});
your code works perfectly fine with me. can you try and let me know if it works or not?
var win1 = Ti.UI.createWindow({
title:'home',
backgroundColor:'white'
});
var button1 = Ti.UI.createButton({
top: 44,
left: 5,
width: 310,
height: 42,
backgroundColor: '#333',
backgroundSelectedColor: '#fff',
backgroundFocusedColor: '#fff',
touchEnabled: true,
borderWidth: 2,
borderRadius: 5
});
win1.add(button1);
win1.open();
can you use backgroundSelectedColor:"#colorcode" in the tss.hope it ll work
use backgroundSelectedColor:"color" ,it ll work

Overriding the always-top property of the navigation bar in Titanium

In Titanium for iPhone is it possible to display something above the navigation bar – or just disabling the always-top property of the navigation bar?
This is how it looks right now:
This is part of the actual Photoshop-mock-up:
The code-snippet invoking this is:
var win1 = Titanium.UI.createWindow({
title: 'Home',
navBarHidden: false,
barImage: 'topbar.png',
backgroundImage: 'bga.png'
});
c = Titanium.UI.createImageView({
image: 'logobar.png',
top: -13,
right: 7,
width: 74,
height: 108,
exitOnClose: !0
})
try {
win1.add(c);
c.animate({zIndex:3});
win1.addEventListener('focus', function () {
Titanium.App.Analytics.trackPageview('/win1')
});
}catch(e){
alert(e);
}
The try-catch was implemented as I didn't trust the existence of .animate, however it did exist but did not work.
Answer(, or maybe not what it should be like)
Titanium itself does not support the feature of manipulating the zIndex or rather the onTop-properties. However, I've found a workaround allowing the overlay to be shown.
This workaround works by the way Titanium handles windows. First, we define the main window (e.g. win1) and fill it. Then we create an assistant window (e.g. win1a) and assign the ImageView to it. Then we position the new window on top of the other window and voilà.
var win1 = Titanium.UI.createWindow({
title: "*******",
navBarHidden: false,
barImage: 'topbar.png',
backgroundColor: "gray",
});
var win1l = Titanium.UI.createWindow({
title: "",
navBarHidden: true,
height: 84,
width: 64,
right: 0,
top: 0
});
// Inject ImageView into top-most window
win1l.add(Titanium.UI.createImageView({
image: "logobar.png",
top: 2,
right: 5,
width: 60.3, //74, // 74/108 = 0.6851851852
height: 88, //108, // ((108-20)*(74/108)) = 60.29629 ~ 60.3
exitOnClose: !0
}));
win1l.open();
I hope this might have been helpful for you.
Thanks, -Kenan.

Titanium: Create fields like the ones in iPhone Contacts (Edit Mode) app

Note: The divider aka separator is the main point of this question. It must be visible.
Is there a way to create fields like the ones in the iPhone Contacts (Edit Contact Mode) app?
I want to create a separator that separates the titleLabel from the textField.
Like " First Name | hinttext "
Instead of " First Name hinttext "
I think what I am trying to do is similar to this... except that I am using Titanium. Is there any way to do this using Titanium?
How is iPhone Contact app's detail View implemented
#MRT and anyone who knows:
How would you make the combined view such that it looks like this?
____________________
( Name | hinttext )
--------------------
You will have to create a new TableViewRow and customize it.
You can put labels, fields, images, etc. in the TableViewRow.
Example:
var row = Ti.UI.createTableViewRow();
var label = Ti.UI.createLabel({
text: "Name",
width: 50,
top: 5,
bottom: 5,
left: 5,
font: {fontSize:10}
});
row.add(label);
Try it this really usefull to you
var view1 = Ti.UI.createView({
height : 50,
width: 150,
top: 5,
bottom: 5,
left: 5,
font: {fontSize:10}
});
var text1 = Ti.UI.createTextField({
hintText : 'First Name',
height : 50,
width: 75,
top: 0,
left: 0,
font: {fontSize:10}
});
var text2 = Ti.UI.createTextField({
hintText : 'hint text',
height : 50,
width: 75,
top: 0,
left: 75,
font: {fontSize:10}
});
view1.add(text1);
view1.add(text2);
you have 2 way to do this.
take 2 TextField and adjust (top and left margin) and joint it.
or
1 Take 1 TextField
2. take 1 Label and its width 2 and height is equal to the textfield height.
3. TextField.add(lable1)
var win1 = Ti.UI.createWindow({
title : 'Window1',
backgroundColor : '#f00',
id : 0,
});
var text1 = Ti.UI.createTextField({
width : 150,
height : 50,
borderRadius : 9,
backgroundColor : '#fff',
top : 50,
left : 20,
});
var label1 = Ti.UI.createLabel({
width : 2,
height : 50,
top : 0,
left : 75,
});
text1.add(label1);
win1.add(text1);
win1.open();
To add a vertical line
var vline = Ti.UI.createView({
height: 44,
width: 1,
top: 0,
left: 85,
backgroundColor:'#CCC'
});
row.add(vline);
You just have to create a TableViewRow and add labels to it. There is not a ready template to this rows. But you can create an wrapper to it, if you will use it a lot. For example:
var createTableViewRowWithTitleAndValue(title, value) {
// TableViewRow
row = Ti.UI.createTableViewRow({
backgroundColor: "#FFFFFF"
});
// Title
row.add(Ti.UI.createLabel({
text: title,
left: 5,
font: { fontWeight: "bold" }
}));
// Value
row.add(Ti.UI.createLabel({
text: value,
right: 5,
textAlign: "right"
}));
}
Then, when you set data to TableView, instead you create a new TableViewRow, you create a new tableViewRowWithTitleAndValue, with title and value needed. For example:
rows.push(new createTableViewRowWithTitleAndValue("Foo", "Bar"));