我们在from openpyxl.chart import (
Reference,
Series,
BarChart
)
wb = load_workbook('revenue.xlsx')
wsheet = wb.get_sheet_by_name('sales')
print (wsheet)
data = Reference(wsheet, min_col=5, min_row=2, max_col=5, max_row=10)
方法中提到的元组是什么意思?在下面: -
data = Reference(wsheet, (5, 2), (5, 10))
OR
import React , { Component } from 'react';
import { connect } from "react-redux";
import { fetchPrescriptionFromUrl } from '../actions/index.js';
import { Link } from 'react-router';
import PrescriptionNew from './new.jsx';
import '../app.css';
class PrescriptionIndex extends Component {
componentDidMount(){
this.props.fetchData(PORT+'/prescriptions');
}
render() {
if (this.props.has_error){
return(<p> Fetching an Api results in error</p>)
}
if (this.props.has_loading){
return(<p> Loading...</p>)
}
return(
<div>
<PrescriptionNew />
{this.props.prescriptions.prescriptions && this.props.prescriptions.prescriptions.map(function(data){
return (
<div className="image-prescription" key={data.id}>
<Link to={"/update/" + data.id} >
<img src={data.image_path.image_path.url}
className="prescription-image"
alt="prescription"
/>
</Link>
</div>
);
}); }
</div>
)
}
}
export default PrescriptionIndex;
我浏览了一些文档,但对我来说并不是那么清楚
答案 0 :(得分:0)
openpyxl.chart.reference
的源代码相对较短。摘录如下。另请参阅OpenPyXL文档中的Creating a chart。参数(5, 2)
和(5, 10)
指的是Excel工作表中包含您正在绘制的图表数据的单元格范围的起点和终点。
class Reference(Strict):
"""
Normalise cell range references
"""
min_row = MinMax(min=1, max=1000000, expected_type=int)
max_row = MinMax(min=1, max=1000000, expected_type=int)
min_col = MinMax(min=1, max=16384, expected_type=int)
max_col = MinMax(min=1, max=16384, expected_type=int)
range_string = String(allow_none=True)
def __init__(self,
worksheet=None,
min_col=None,
min_row=None,
max_col=None,
max_row=None,
range_string=None
):
if range_string is not None:
sheetname, boundaries = range_to_tuple(range_string)
min_col, min_row, max_col, max_row = boundaries
worksheet = DummyWorksheet(sheetname)