Hi Roman, I think these would be excellent extensions to POI. I am certain others will respond in the next several days.
> I think proposed class names not the best ones, if you know better ones - > welcome. It is spelled "Scatter" and not "Scetter". Let's see what others have to say about your proposal. Regards, Dave On May 13, 2011, at 7:24 AM, Roman Kashitsyn wrote: > > Hello. In my current project I have to create xlsx charts programmaticaly. > As I can see, at the moment POI has not enought capabilities for that. So I > want to collaborate with POI developers to teach POI to work with charts. I > have proposed code to allow user create new charts ( > http://apache-poi.1045710.n5.nabble.com/DO-NOT-REPLY-Bug-51196-New-PATCH-Patch-to-simplify-XSSFChart-creation-tp4392907p4392907.html > patch 51196 ), but they still have to fill chart content by themselves. > > > The next step is to allow users to create different charts without direct > xmlbeans library usage. ECMA-376 describes 16 chart types. So we need to > organize classes in some rational model. I thought a lot about it and here > is my proposal: lets add to XSSFChart factory method, say, > plot(XSSFChartData), to plot a specific data on a chart. XSSFChartData will > be an interface (or an abstract class) that incapsulates specific plot logic > (i.e. working with CTPlotArea). > > The implementation could be something like that: > > > /* XSSFChartData.java */ > public interface XSSFChartData() { > void fillChart(CTPlotArea ctArea); > } > > /* XSSFChart.java */ > public void plot(XSSFChartData data) { > data.fillChart(getCTChart().getPlotArea()); > } > > /* XSSFScetterChartData.java */ > public class XSSFScetterChartData implements XSSFChartData { > public void fillChart(CTPlotArea area) { > CTScetterChart scetterChart = area.addNewScetterChart(); > /* .... */ > } > } > > > Here is a code snippet illustrating the idea: > > XSSFChart chart = drawing.createChart(anchor); > XSSFScetterChartData chartData = new XSSFScetterChartData(); > XSSFScetterChartData.Serie serie = chartData.addSerie(); > serie.setXValues(range); > serie.setYValues(anotherRange); > chart.plot(chartData); > > > > I think proposed class names not the best ones, if you know better ones - > welcome. > > > > Here is benefits of such approach: > > no any if\switches: polymorphism rules; > the same data can be plotted in multiple charts - orthogonality is always a > plus (if you don't believe me - read "Programmatic Programmer"); > > I think a new package should be introduced to contain chart data classes > (suppose, org.apache.poi.xssf.usermodel.charts). > > > What do you think about all this? > > Thank you in advance > > Roman Kashitsyn > > > > -- > View this message in context: > http://apache-poi.1045710.n5.nabble.com/Chart-model-in-XSSF-tp4393269p4393269.html > Sent from the POI - Dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
