Flot tick标签使用font-size:small来打破它们的位置

时间:2015-11-28 02:07:26

标签: margin flot font-size labels

我正在使用Flot水平条形图。 条形图的标签为<div class="flot-text"> - 继承自包含标签的$(".tagChart .flot-text").css("font-size", ""); // Flot uses "smaller" which breaks alignment.

这打破了标签的定位: [![Flot bar chart Broken labels] [1]] [1]

所以我需要这样做

            yaxis: {
                // Otherwise Flot uses "smaller" which breaks alignment.
                //font: { size: "14px", color: "black" }, // doesn't work
            },

哪个有点hacky。这不起作用:

smaller

我该如何阻止添加table { font-size: 12; } ?另外,有趣的是它在不同的DOM / CSS上下文中没有出现在页面的其他地方。

编辑:看起来它可能与Bootstrap的CSS规则有一些共同点,它由其内容继承:

override func viewDidLoad() {
    super.viewDidLoad()

    incomeExpenseTableView.reloadData()
    incomeExpenseTableView.delegate = self
    incomeExpenseTableView.dataSource = self
}

override func viewDidAppear(animated: Bool) {
    incomeExpenseTableView.reloadData()
}


@IBAction func addButtonPressed(sender: AnyObject) {
    let addMessage = SCLAlertView()
    addMessage.addButton("Income") {
        self.performSegueWithIdentifier("incomeSegue", sender: self)

    }
    addMessage.addButton("Expense") {
        self.performSegueWithIdentifier("expenseSegue", sender: self)
    }
    addMessage.showInfo("New Entry", subTitle: "Select either an income or expense to add")

}


func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

    let post = DATA_KEY._loadedPosts[indexPath.row]

    if let cell = tableView.dequeueReusableCellWithIdentifier("IncomeExpenseCell") as? IncomeExpenseCell {
        cell.configureCell(post)
        return cell
    } else {
        let cell = IncomeExpenseCell()
        cell.configureCell(post)
        return cell
    }

}

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return DataService.instance._loadedPosts.count
}

func onPostsLoaded(notif: AnyObject) {
    incomeExpenseTableView.reloadData()
}

1 个答案:

答案 0 :(得分:1)

尝试将所有标签保持相同的宽度(显示:内联块)。使用右对齐文本将其对齐在同一行