OWC11 - Dynamically draw chart from datasource with null values and splitting of a chart


P

petruccig

Hi,
i'm searching for a solution.I'm developing th home page
(default.aspx) of my site and I would make a OWC11 chart.
The problem is that I have a <img> in this aspx and I use the
ExportPicture method to show the chart.

I wrote a method in default.aspx.vb to create the chart, this is the
code:

"dsPrice.ReadXml(ConfigurationManager.AppSettings("WebItaPath") & "Unit
\Cumul.xml")

Dim Chart1, Chart1_Series1

Dim ChartSpace1 = New OWC11.ChartSpaceClass


Dim xp, xn, xe, y, i

Dim NumRighe As Integer

NumRighe = dsPrezziEt.Tables(0).Rows.Count - 1



ReDim xp(NumRighe)

ReDim xe(NumRighe)

ReDim xn(NumRighe)

ReDim y(NumRighe)



i = 0



For Each drPrezziEt In dsPrice.Tables(0).Rows


xp(i) = drPrezziEt.Item("Powernext")

xe(i) = drPrezziEt.Item("EEX")

xn(i) = drPrezziEt.Item("NordPool")

y(i) = drPrezziEt.Item("Data")


i = i + 1

Next


ChartSpace1.clear()

ChartSpace1.Refresh()



'Build graph

Chart1 = ChartSpace1.Charts.Add(0)



Chart1_Series1 = Chart1.SeriesCollection.Add(0)

With Chart1

.HasTitle = False

.Border.Color = "white"

With .PlotArea

.Interior.Color = "white"

.Border.Color = "white"

End With


With .Axes(OWC11.ChartAxisPositionEnum.chAxisPositionBottom)

.MajorTickMarks = ChartTickMarkEnum.chTickMarkNone

.Line.Color = "lightgrey"

.TickLabelSpacing = 25

.font.size = 6


End With

With .Axes(OWC11.ChartAxisPositionEnum.chAxisPositionLeft)

.MajorTickMarks = ChartTickMarkEnum.chTickMarkNone

.MajorGridlines.Line.Color = "lightgrey"

.Line.Color = "lightgrey"

.HasTitle = True

.Title.Caption = "€/t CO2"

.Title.Font.Size = 7

End With

End With

Chart1_Series1.Line.Color = "darkgreen"

Chart1_Series1.Type = OWC11.ChartChartTypeEnum.chChartTypeLine


Chart1_Series1.SetData(OWC11.ChartDimensionsEnum.chDimSeriesNames,
OWC11.ChartSpecialDataSourcesEnum.chDataLiteral, "Chart1_Series1")


Chart1_Series1.SetData(OWC11.ChartDimensionsEnum.chDimCategories,
OWC11.ChartSpecialDataSourcesEnum.chDataLiteral, y)

Chart1_Series1.SetData(OWC11.ChartDimensionsEnum.chDimValues,
OWC11.ChartSpecialDataSourcesEnum.chDataLiteral, xp)

Chart1_Series1.SetData(OWC11.ChartDimensionsEnum.chDimValues,
OWC11.ChartSpecialDataSourcesEnum.chDataLiteral, xe)

Chart1_Series1.SetData(OWC11.ChartDimensionsEnum.chDimValues,
OWC11.ChartSpecialDataSourcesEnum.chDataLiteral, xn)

Dim ImagePath As String

ImagePath = ConfigurationManager.AppSettings("GraphPath") &
"Graphs\Cumul.gif"

ImgET.Visible = True

ChartSpace1.ExportPicture(ImagePath, "gif", 270, 120)

'405, 180)

Me.ImgET.ImageUrl = "\Images\Graphs\Cumul.gif"


End Sub"

The chart that I can see after default.aspx execution is wrong,because
there are same null value in xp, xn, xe array.I would to use the tips
in http://support.microsoft.com/default.aspx?scid=kb;EN-US;q286317,but
I don't know where I must put the class attribute to "clsid:
0002E55D-0000-0000-C000-000000000046".Are there any other solution?
Then I would to split my chart in 3 parts,one for every: xp, xn, xe
series.How can I do it?
Can you help me,please?
Thank you in advance!!!
 
Ad

Advertisements

A

Alvin Bruney [MVP]

I don't understand your question. If you already see a chart, there is no
need for a clsid. A chart cannot be split into different parts.

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley


Hi,
i'm searching for a solution.I'm developing th home page
(default.aspx) of my site and I would make a OWC11 chart.
The problem is that I have a <img> in this aspx and I use the
ExportPicture method to show the chart.

I wrote a method in default.aspx.vb to create the chart, this is the
code:

"dsPrice.ReadXml(ConfigurationManager.AppSettings("WebItaPath") & "Unit
\Cumul.xml")

Dim Chart1, Chart1_Series1

Dim ChartSpace1 = New OWC11.ChartSpaceClass


Dim xp, xn, xe, y, i

Dim NumRighe As Integer

NumRighe = dsPrezziEt.Tables(0).Rows.Count - 1



ReDim xp(NumRighe)

ReDim xe(NumRighe)

ReDim xn(NumRighe)

ReDim y(NumRighe)



i = 0



For Each drPrezziEt In dsPrice.Tables(0).Rows


xp(i) = drPrezziEt.Item("Powernext")

xe(i) = drPrezziEt.Item("EEX")

xn(i) = drPrezziEt.Item("NordPool")

y(i) = drPrezziEt.Item("Data")


i = i + 1

Next


ChartSpace1.clear()

ChartSpace1.Refresh()



'Build graph

Chart1 = ChartSpace1.Charts.Add(0)



Chart1_Series1 = Chart1.SeriesCollection.Add(0)

With Chart1

.HasTitle = False

.Border.Color = "white"

With .PlotArea

.Interior.Color = "white"

.Border.Color = "white"

End With


With .Axes(OWC11.ChartAxisPositionEnum.chAxisPositionBottom)

.MajorTickMarks = ChartTickMarkEnum.chTickMarkNone

.Line.Color = "lightgrey"

.TickLabelSpacing = 25

.font.size = 6


End With

With .Axes(OWC11.ChartAxisPositionEnum.chAxisPositionLeft)

.MajorTickMarks = ChartTickMarkEnum.chTickMarkNone

.MajorGridlines.Line.Color = "lightgrey"

.Line.Color = "lightgrey"

.HasTitle = True

.Title.Caption = "?/t CO2"

.Title.Font.Size = 7

End With

End With

Chart1_Series1.Line.Color = "darkgreen"

Chart1_Series1.Type = OWC11.ChartChartTypeEnum.chChartTypeLine


Chart1_Series1.SetData(OWC11.ChartDimensionsEnum.chDimSeriesNames,
OWC11.ChartSpecialDataSourcesEnum.chDataLiteral, "Chart1_Series1")


Chart1_Series1.SetData(OWC11.ChartDimensionsEnum.chDimCategories,
OWC11.ChartSpecialDataSourcesEnum.chDataLiteral, y)

Chart1_Series1.SetData(OWC11.ChartDimensionsEnum.chDimValues,
OWC11.ChartSpecialDataSourcesEnum.chDataLiteral, xp)

Chart1_Series1.SetData(OWC11.ChartDimensionsEnum.chDimValues,
OWC11.ChartSpecialDataSourcesEnum.chDataLiteral, xe)

Chart1_Series1.SetData(OWC11.ChartDimensionsEnum.chDimValues,
OWC11.ChartSpecialDataSourcesEnum.chDataLiteral, xn)

Dim ImagePath As String

ImagePath = ConfigurationManager.AppSettings("GraphPath") &
"Graphs\Cumul.gif"

ImgET.Visible = True

ChartSpace1.ExportPicture(ImagePath, "gif", 270, 120)

'405, 180)

Me.ImgET.ImageUrl = "\Images\Graphs\Cumul.gif"


End Sub"

The chart that I can see after default.aspx execution is wrong,because
there are same null value in xp, xn, xe array.I would to use the tips
in http://support.microsoft.com/default.aspx?scid=kb;EN-US;q286317,but
I don't know where I must put the class attribute to "clsid:
0002E55D-0000-0000-C000-000000000046".Are there any other solution?
Then I would to split my chart in 3 parts,one for every: xp, xn, xe
series.How can I do it?
Can you help me,please?
Thank you in advance!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top