S
silver23
Re-creating Jon Peltier's Floating Columns using OWC11, it appears the upper,
or "floating", column renders an unwanted border bottom when the upper column
has a N/A or zero (0) value. Is there another solution besides not using
border color on the floating column?
In the following code example, the first occurence of chartHighValues
exhibits the "bug"
using System;
using System.Web;
using System.IO;
using OWC11;
namespace AspNetResources.Owc
{
public partial class _default : System.Web.UI.Page
{
protected void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
FloatingColumns ();
}
private void FloatingColumns ()
{
string[] chartLowValues = new string[] { "1", "1.1", "1.2",
"1.3", "1.4", "1.5", "1.6", "1.7", "1.25" };
string[] chartHighValues = new string[] { "N/A", ".1", "1",
".75", ".5", ".4", ".3", ".2", "1" };
string[] chartDateCategory = new string[] { "08/21/06",
"08/22/06", "08/23/06", "08/24/06", "08/25/06", "08/28/06", "08/29/06",
"08/30/06", "08/31/06" };
string chartDateCategoryString = String.Join ("\t",
chartDateCategory);
string chartValuesStrLow = String.Join ("\t", chartLowValues);
string chartValuesStrHigh = String.Join("\t", chartHighValues);
OWC11.ChartSpaceClass oChartSpace = new
OWC11.ChartSpaceClass ();
OWC11.ChartChartTypeEnum chartType;
chartType = ChartChartTypeEnum.chChartTypeColumnStacked;
oChartSpace.HasChartSpaceLegend = true;
oChartSpace.ChartSpaceLegend.Position =
ChartLegendPositionEnum.chLegendPositionTop;
oChartSpace.ChartSpaceLegend.Border.Color =
OWC11.ChartColorIndexEnum.chColorNone;
oChartSpace.ChartSpaceLegend.Font.Size = 8;
oChartSpace.ChartSpaceLegend.Font.Color = "GRAY";
oChartSpace.Border.Color = OWC11.ChartColorIndexEnum.chColorNone;
oChartSpace.Charts.Add(0);
oChartSpace.Charts[0].Type = chartType;
oChartSpace.Charts[0].ChartDepth = 125;
oChartSpace.Charts[0].AspectRatio = 80;
/* Plot Area */
oChartSpace.Charts[0].PlotArea.Interior.Color =
OWC11.ChartColorIndexEnum.chColorNone;
oChartSpace.Charts[0].PlotArea.Border.Color =
OWC11.ChartColorIndexEnum.chColorNone;
/* New Series Collections */
oChartSpace.Charts[0].SeriesCollection.Add(0);
oChartSpace.Charts[0].SeriesCollection.Add(1);
/* Axes */
oChartSpace.Charts[0].Axes[0].Font.Name = "arial";
oChartSpace.Charts[0].Axes[1].Font.Name = "arial";
oChartSpace.Charts[0].Axes[0].Font.Size = 8;
oChartSpace.Charts[0].Axes[1].Font.Size = 8;
oChartSpace.Charts[0].Axes[0].Font.Color = "GRAY";
oChartSpace.Charts[0].Axes[1].Font.Color = "GRAY";
oChartSpace.Charts[0].Axes[1].HasMajorGridlines = false;
/* Don't Fill-in Weekend/Holiday Dates */
oChartSpace.Charts[0].Axes[0].GroupingType =
OWC11.ChartAxisGroupingEnum.chAxisGroupingNone;
/* Remove tick marks for both axes */
oChartSpace.Charts[0].Axes[0].MajorTickMarks =
OWC11.ChartTickMarkEnum.chTickMarkNone;
oChartSpace.Charts[0].Axes[1].MajorTickMarks =
OWC11.ChartTickMarkEnum.chTickMarkNone;
/* Paint axis lines white until figure-out how to delete them */
oChartSpace.Charts[0].Axes[0].Line.Color = "white";
oChartSpace.Charts[0].Axes[1].Line.Color = "white";
oChartSpace.Charts[0].SeriesCollection[0].Caption = "Bottom
Column";
oChartSpace.Charts[0].SeriesCollection[0].Border.Color = "white";
oChartSpace.Charts[0].SeriesCollection[0].Interior.Color =
"white";
/*Whether SeriesCollection[0] Color(s) are white or chColorNone,
the N/A Floating Column above produces a blue border-bottom.
Specifying N/A for both low and high values, though, removes it
by "hiding" it
below the minimum scaling value. Specifying "0" for the high
value also produces the
blue border-bottom. Another solution, don't use border for the
floater.
oChartSpace.Charts[0].SeriesCollection[0].Border.Color =
OWC11.ChartColorIndexEnum.chColorNone;
oChartSpace.Charts[0].SeriesCollection[0].Interior.Color =
OWC11.ChartColorIndexEnum.chColorNone;*/
/* Style the High Series */
oChartSpace.Charts[0].SeriesCollection[1].Caption = "Floating
Column";
oChartSpace.Charts[0].SeriesCollection[1].Border.Color = "BLUE";
oChartSpace.Charts[0].SeriesCollection[1].Interior.Color =
"white";
/* Add Dates */
oChartSpace.Charts[0].SeriesCollection[0].SetData
(OWC11.ChartDimensionsEnum.chDimCategories,
Convert.ToInt32(OWC11.ChartSpecialDataSourcesEnum.chDataLiteral),
chartDateCategoryString);
/* Add Low Series */
oChartSpace.Charts[0].SeriesCollection[0].SetData
(OWC11.ChartDimensionsEnum.chDimValues,
Convert.ToInt32(OWC11.ChartSpecialDataSourcesEnum.chDataLiteral),
chartValuesStrLow);
/* Add High Series */
oChartSpace.Charts[0].SeriesCollection[1].SetData(OWC11.ChartDimensionsEnum.chDimValues,
Convert.ToInt32(OWC11.ChartSpecialDataSourcesEnum.chDataLiteral),
chartValuesStrHigh);
oChartSpace.Charts[0].Axes[1].Scaling.Minimum = .75;
oChartSpace.Charts[0].Axes[1].MajorUnit = .25;
byte[] byteArr = (byte[]) oChartSpace.GetPicture ("png", 980,
580);
HttpContext ctx = HttpContext.Current;
string chartID = Guid.NewGuid ().ToString ();
ctx.Session [chartID] = byteArr;
imgOutput.ImageUrl = string.Concat ("chart.ashx?", chartID);
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
#endregion
}
}
or "floating", column renders an unwanted border bottom when the upper column
has a N/A or zero (0) value. Is there another solution besides not using
border color on the floating column?
In the following code example, the first occurence of chartHighValues
exhibits the "bug"
using System;
using System.Web;
using System.IO;
using OWC11;
namespace AspNetResources.Owc
{
public partial class _default : System.Web.UI.Page
{
protected void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
FloatingColumns ();
}
private void FloatingColumns ()
{
string[] chartLowValues = new string[] { "1", "1.1", "1.2",
"1.3", "1.4", "1.5", "1.6", "1.7", "1.25" };
string[] chartHighValues = new string[] { "N/A", ".1", "1",
".75", ".5", ".4", ".3", ".2", "1" };
string[] chartDateCategory = new string[] { "08/21/06",
"08/22/06", "08/23/06", "08/24/06", "08/25/06", "08/28/06", "08/29/06",
"08/30/06", "08/31/06" };
string chartDateCategoryString = String.Join ("\t",
chartDateCategory);
string chartValuesStrLow = String.Join ("\t", chartLowValues);
string chartValuesStrHigh = String.Join("\t", chartHighValues);
OWC11.ChartSpaceClass oChartSpace = new
OWC11.ChartSpaceClass ();
OWC11.ChartChartTypeEnum chartType;
chartType = ChartChartTypeEnum.chChartTypeColumnStacked;
oChartSpace.HasChartSpaceLegend = true;
oChartSpace.ChartSpaceLegend.Position =
ChartLegendPositionEnum.chLegendPositionTop;
oChartSpace.ChartSpaceLegend.Border.Color =
OWC11.ChartColorIndexEnum.chColorNone;
oChartSpace.ChartSpaceLegend.Font.Size = 8;
oChartSpace.ChartSpaceLegend.Font.Color = "GRAY";
oChartSpace.Border.Color = OWC11.ChartColorIndexEnum.chColorNone;
oChartSpace.Charts.Add(0);
oChartSpace.Charts[0].Type = chartType;
oChartSpace.Charts[0].ChartDepth = 125;
oChartSpace.Charts[0].AspectRatio = 80;
/* Plot Area */
oChartSpace.Charts[0].PlotArea.Interior.Color =
OWC11.ChartColorIndexEnum.chColorNone;
oChartSpace.Charts[0].PlotArea.Border.Color =
OWC11.ChartColorIndexEnum.chColorNone;
/* New Series Collections */
oChartSpace.Charts[0].SeriesCollection.Add(0);
oChartSpace.Charts[0].SeriesCollection.Add(1);
/* Axes */
oChartSpace.Charts[0].Axes[0].Font.Name = "arial";
oChartSpace.Charts[0].Axes[1].Font.Name = "arial";
oChartSpace.Charts[0].Axes[0].Font.Size = 8;
oChartSpace.Charts[0].Axes[1].Font.Size = 8;
oChartSpace.Charts[0].Axes[0].Font.Color = "GRAY";
oChartSpace.Charts[0].Axes[1].Font.Color = "GRAY";
oChartSpace.Charts[0].Axes[1].HasMajorGridlines = false;
/* Don't Fill-in Weekend/Holiday Dates */
oChartSpace.Charts[0].Axes[0].GroupingType =
OWC11.ChartAxisGroupingEnum.chAxisGroupingNone;
/* Remove tick marks for both axes */
oChartSpace.Charts[0].Axes[0].MajorTickMarks =
OWC11.ChartTickMarkEnum.chTickMarkNone;
oChartSpace.Charts[0].Axes[1].MajorTickMarks =
OWC11.ChartTickMarkEnum.chTickMarkNone;
/* Paint axis lines white until figure-out how to delete them */
oChartSpace.Charts[0].Axes[0].Line.Color = "white";
oChartSpace.Charts[0].Axes[1].Line.Color = "white";
oChartSpace.Charts[0].SeriesCollection[0].Caption = "Bottom
Column";
oChartSpace.Charts[0].SeriesCollection[0].Border.Color = "white";
oChartSpace.Charts[0].SeriesCollection[0].Interior.Color =
"white";
/*Whether SeriesCollection[0] Color(s) are white or chColorNone,
the N/A Floating Column above produces a blue border-bottom.
Specifying N/A for both low and high values, though, removes it
by "hiding" it
below the minimum scaling value. Specifying "0" for the high
value also produces the
blue border-bottom. Another solution, don't use border for the
floater.
oChartSpace.Charts[0].SeriesCollection[0].Border.Color =
OWC11.ChartColorIndexEnum.chColorNone;
oChartSpace.Charts[0].SeriesCollection[0].Interior.Color =
OWC11.ChartColorIndexEnum.chColorNone;*/
/* Style the High Series */
oChartSpace.Charts[0].SeriesCollection[1].Caption = "Floating
Column";
oChartSpace.Charts[0].SeriesCollection[1].Border.Color = "BLUE";
oChartSpace.Charts[0].SeriesCollection[1].Interior.Color =
"white";
/* Add Dates */
oChartSpace.Charts[0].SeriesCollection[0].SetData
(OWC11.ChartDimensionsEnum.chDimCategories,
Convert.ToInt32(OWC11.ChartSpecialDataSourcesEnum.chDataLiteral),
chartDateCategoryString);
/* Add Low Series */
oChartSpace.Charts[0].SeriesCollection[0].SetData
(OWC11.ChartDimensionsEnum.chDimValues,
Convert.ToInt32(OWC11.ChartSpecialDataSourcesEnum.chDataLiteral),
chartValuesStrLow);
/* Add High Series */
oChartSpace.Charts[0].SeriesCollection[1].SetData(OWC11.ChartDimensionsEnum.chDimValues,
Convert.ToInt32(OWC11.ChartSpecialDataSourcesEnum.chDataLiteral),
chartValuesStrHigh);
oChartSpace.Charts[0].Axes[1].Scaling.Minimum = .75;
oChartSpace.Charts[0].Axes[1].MajorUnit = .25;
byte[] byteArr = (byte[]) oChartSpace.GetPicture ("png", 980,
580);
HttpContext ctx = HttpContext.Current;
string chartID = Guid.NewGuid ().ToString ();
ctx.Session [chartID] = byteArr;
imgOutput.ImageUrl = string.Concat ("chart.ashx?", chartID);
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
#endregion
}
}