Skip to content

Commit

Permalink
fix scatterchart ooxml node issue
Browse files Browse the repository at this point in the history
TitleType of the serie is not nullable, IsTitleTypeSet is always true,
which is incorrect
  • Loading branch information
Tony Qu committed Mar 5, 2016
1 parent a55b2ad commit be6fb72
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
12 changes: 6 additions & 6 deletions examples/xssf/LineChart/Program.cs
Expand Up @@ -23,21 +23,21 @@ static void CreateChart(IDrawing drawing, ISheet sheet, IClientAnchor anchor, st
IChartLegend legend = chart.GetOrCreateLegend();
legend.Position = LegendPosition.TopRight;

ILineChartData<double, double> data = chart.GetChartDataFactory().CreateLineChartData<double, double>();
ILineChartData<double, double> data = chart.ChartDataFactory.CreateLineChartData<double, double>();

// Use a category axis for the bottom axis.
IChartAxis bottomAxis = chart.GetChartAxisFactory().CreateCategoryAxis(AxisPosition.Bottom);
IValueAxis leftAxis = chart.GetChartAxisFactory().CreateValueAxis(AxisPosition.Left);
leftAxis.SetCrosses(AxisCrosses.AutoZero);
IChartAxis bottomAxis = chart.ChartAxisFactory.CreateCategoryAxis(AxisPosition.Bottom);
IValueAxis leftAxis = chart.ChartAxisFactory.CreateValueAxis(AxisPosition.Left);
leftAxis.Crosses = AxisCrosses.AutoZero;

IChartDataSource<double> xs = DataSources.FromNumericCellRange(sheet, new CellRangeAddress(0, 0, 0, NUM_OF_COLUMNS - 1));
IChartDataSource<double> ys1 = DataSources.FromNumericCellRange(sheet, new CellRangeAddress(1, 1, 0, NUM_OF_COLUMNS - 1));
IChartDataSource<double> ys2 = DataSources.FromNumericCellRange(sheet, new CellRangeAddress(2, 2, 0, NUM_OF_COLUMNS - 1));


var s1 = data.AddSerie(xs, ys1);
var s1 = data.AddSeries(xs, ys1);
s1.SetTitle(serie1);
var s2 = data.AddSerie(xs, ys2);
var s2 = data.AddSeries(xs, ys2);
s2.SetTitle(serie2);

chart.Plot(data, bottomAxis, leftAxis);
Expand Down
12 changes: 6 additions & 6 deletions examples/xssf/ScatterChart/Program.cs
Expand Up @@ -39,19 +39,19 @@ static void Main(string[] args)
IChartLegend legend = chart.GetOrCreateLegend();
legend.Position = (LegendPosition.TopRight);

IScatterChartData<double, double> data = chart.GetChartDataFactory().CreateScatterChartData<double, double>();
IScatterChartData<double, double> data = chart.ChartDataFactory.CreateScatterChartData<double, double>();

IValueAxis bottomAxis = chart.GetChartAxisFactory().CreateValueAxis(AxisPosition.Bottom);
IValueAxis leftAxis = chart.GetChartAxisFactory().CreateValueAxis(AxisPosition.Left);
leftAxis.SetCrosses(AxisCrosses.AutoZero);
IValueAxis bottomAxis = chart.ChartAxisFactory.CreateValueAxis(AxisPosition.Bottom);
IValueAxis leftAxis = chart.ChartAxisFactory.CreateValueAxis(AxisPosition.Left);
leftAxis.Crosses = AxisCrosses.AutoZero;

IChartDataSource<double> xs = DataSources.FromNumericCellRange(sheet, new CellRangeAddress(0, 0, 0, NUM_OF_COLUMNS - 1));
IChartDataSource<double> ys1 = DataSources.FromNumericCellRange(sheet, new CellRangeAddress(1, 1, 0, NUM_OF_COLUMNS - 1));
IChartDataSource<double> ys2 = DataSources.FromNumericCellRange(sheet, new CellRangeAddress(2, 2, 0, NUM_OF_COLUMNS - 1));


data.AddSerie(xs, ys1);
data.AddSerie(xs, ys2);
data.AddSeries(xs, ys1);
data.AddSeries(xs, ys2);
chart.Plot(data, bottomAxis, leftAxis);

// Write the output to a file
Expand Down
18 changes: 9 additions & 9 deletions examples/xssf/ScatterChart/ScatterChart.csproj
Expand Up @@ -35,17 +35,17 @@
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>..\..\..\solution\Lib\.net4\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="NPOI, Version=2.0.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\solution\Lib\.net4\NPOI.dll</HintPath>
<Reference Include="NPOI">
<HintPath>..\..\..\solution\Lib\NPOI.dll</HintPath>
</Reference>
<Reference Include="NPOI.OOXML, Version=2.0.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\solution\Lib\.net4\NPOI.OOXML.dll</HintPath>
<Reference Include="NPOI.OOXML">
<HintPath>..\..\..\solution\Lib\NPOI.OOXML.dll</HintPath>
</Reference>
<Reference Include="NPOI.OpenXmlFormats, Version=2.0.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\solution\Lib\.net4\NPOI.OpenXmlFormats.dll</HintPath>
<Reference Include="NPOI.OpenXml4Net">
<HintPath>..\..\..\solution\Lib\NPOI.OpenXml4Net.dll</HintPath>
</Reference>
<Reference Include="NPOI.OpenXmlFormats">
<HintPath>..\..\..\solution\Lib\NPOI.OpenXmlFormats.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
2 changes: 1 addition & 1 deletion main/SS/UserModel/Charts/ChartSeries.cs
Expand Up @@ -40,6 +40,6 @@ public interface IChartSeries
/**
* @return title type.
*/
TitleType GetTitleType();
TitleType? GetTitleType();
}
}
4 changes: 2 additions & 2 deletions ooxml/XSSF/UserModel/Charts/AbstractXSSFChartSeries.cs
Expand Up @@ -11,7 +11,7 @@ public class AbstractXSSFChartSeries : IChartSeries
{
private String titleValue;
private CellReference titleRef;
private TitleType titleType;
private TitleType? titleType;
public void SetTitle(string title)
{
titleType = TitleType.String;
Expand Down Expand Up @@ -42,7 +42,7 @@ public CellReference GetTitleCellReference()
throw new InvalidOperationException("Title type is not CellReference.");
}

public TitleType GetTitleType()
public TitleType? GetTitleType()
{
return titleType;
}
Expand Down

0 comments on commit be6fb72

Please sign in to comment.