poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominik Stadler <dominik.stad...@gmx.at>
Subject Re: How to create a line chart without smoothed lines
Date Mon, 01 Jun 2015 20:29:42 GMT
I did not actually try this so it is completely untested, but
something like the following should allow to access things inside the
XML without actually needing to change or recompile POI:

        XSSFChart xssfChart = (XSSFChart) chart;
        CTPlotArea plotArea = xssfChart.getCTChart().getPlotArea();
        plotArea.getLineChartArray()[0].getSmooth();
        CTBoolean ctBool = CTBoolean.Factory.newInstance();
        ctBool.setVal(true);
        plotArea.getLineChartArray()[0].setSmooth(ctBool);

replace getLineChartArray() with any of the other chart types that is
available and iterate over the array if you have multiple plots as
part of a single chart.

Dominik.

On Mon, Jun 1, 2015 at 6:10 PM, Brad Curfman <brad@curfman.net> wrote:
> Dominik,
>
> I narrowed down the required XML to the following
> Set the following property within the <c:ser> block for each data series to
> be 0.
>                 <c:smooth val="0"/>
>
> By default, the c:smooth attribute is not in the XML so Excel assumes it
> should be 1 when rendering the chart.
>
> Can you point me to what class(es) I need to change to have that value set?
> I'm just looking for the quick way to default this to 0 so I can generate
> my own jar for my application.
> I could then look into the changes necessary to incorporate this back into
> the project which would provide an option to set this value to 1, but keep
> the default of 0 since I wouldn't want to break the existing functionality.
>
>
> On Wed, May 27, 2015 at 3:15 PM, Dominik Stadler <dominik.stadler@gmx.at>
> wrote:
>
>> Hi,
>>
>> unfortunately support for charts is not very elaborate at the moment.
>> You can maybe get a glimpse on the required changes in the XML format
>> by doing the minimal necessary changes in Excel and saving the
>> document in a second file.
>>
>> Then the DevTool OOXMLPrettyPrint (available in the POI sources) can
>> help making the two files easier to diff so you can find out which
>> changes are required. BTW, the .xlsx files are internally just zips,
>> some diff-tools support comparing them directly if configured
>> correctly, e.g. BeyondCompare.
>>
>> Thanks... Dominik.
>>
>> On Thu, May 14, 2015 at 7:36 AM, Brad Curfman <wcurfman@hotmail.com>
>> wrote:
>> > I have successfully created an XLSX file containing line chart using
>> POI, but the rendered chart smooths out the lines. You can right click one
>> of the lines in the chart and disable the smoothing, but I need to generate
>> an XLSX with smoothing disabled on all lines. How can this be done? I can't
>> find any API methods available to set the smooth attribute. I did download
>> the source and try to modify the SeriesLabelsRecord class to force the
>> smooth attribute to false, but that didn't do anything. Any help is greatly
>> appreciated.
>> > Thanks,Brad
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Mime
View raw message