Ciao nel mio progetto come componente grafico per la visualizzazione di grafici
utilizzo AxChartSpace (Office Web Component) utilizzo il seguente codice per disegnare il grafico:
codice:
Try
TextBox1.Text = "DatiX " & vbCrLf & DatiX
TextBox1.Text += vbCrLf & vbCrLf & vbCrLf & "DatiY1 " & vbCrLf & DatiY1
AxChartSpace1.Clear()
' Create Chart
AxChartSpace1.Charts.Add(0) ' add new chart to ChartSpace and set it's type
AxChartSpace1.Charts(0).Type = owc11.ChartChartTypeEnum.chChartTypeScatterLine
AxChartSpace1.Charts(0).SeriesCollection.Add() ' add a series
' Plot Data
AxChartSpace1.Charts(0).SeriesCollection(0).SetData(owc11.ChartDimensionsEnum.chDimXValues, CType(Microsoft.Office.Interop.Owc11.ChartSpecialDataSourcesEnum.chDataLiteral, Integer), DatiX)
AxChartSpace1.Charts(0).SeriesCollection(0).SetData(owc11.ChartDimensionsEnum.chDimYValues, CType(Microsoft.Office.Interop.Owc11.ChartSpecialDataSourcesEnum.chDataLiteral, Integer), DatiY1)
' Format Chart Series
AxChartSpace1.Charts(0).SeriesCollection(0).Line.Color = "Black" ' line is still visible
AxChartSpace1.Charts(0).SeriesCollection(0).Marker.Style = owc11.ChartMarkerStyleEnum.chMarkerStyleDiamond
AxChartSpace1.Charts(0).SeriesCollection(0).Marker.Size = 10
AxChartSpace1.Charts(0).SeriesCollection(0).Interior.Color = owc11.XlConstants.xlAutomatic
AxChartSpace1.Charts(0).SeriesCollection(0).Border.Color = "Black"
'Format Chart Background
AxChartSpace1.Charts(0).Interior.Color = "White"
' Format Plot background
AxChartSpace1.Charts(0).PlotArea.BackWall.Interior.Color = owc11.XlColorIndex.xlColorIndexAutomatic
AxChartSpace1.Charts(0).PlotArea.BackWall.Interior.SetSolid(owc11.XlColorIndex.xlColorIndexAutomatic)
AxChartSpace1.Charts(0).PlotArea.Interior.SetSolid(owc11.XlColorIndex.xlColorIndexAutomatic)
AxChartSpace1.Charts(0).PlotArea.Interior.Color = owc11.XlColorIndex.xlColorIndexAutomatic
' note that using "OWC.XlConstants.xlNone" instead of "OWC.XlColorIndex.xlColorIndexNone" does not work either,
'This causes a fatal error:
'AxChartSpace1.Charts(0).PlotArea.Interior.BackColor = owc11.XlColorIndex.xlColorIndexNone
Catch ex As Exception
LocalError("Button2_Click")
End Try
Il problema č che l'asse delle ascisse (Asse x) sono delle date e pertanto dovrei impostare il formato corretto per permettere una corretta visualizzazione.
Qualcuno sā aiutarmi in questo?
Grazie e ciao