Page 1 of 1
Marking Axis
Posted: Thu May 30, 2013 12:19 pm
by 15664465
Hello,
I want to know it is posible in a bar chart mark in the left axis the lines of certain values like each 100.
Thanks
Re: Marking Axis
Posted: Fri May 31, 2013 8:17 am
by 15664465
with marking the line i mean making it wider
Re: Marking Axis
Posted: Fri May 31, 2013 3:06 pm
by 10050769
Hello Fulcrum,
I don't sure understand as you want. Could you please, explain exactly as you want achieve?
Thanks,
Re: Marking Axis
Posted: Mon Jun 03, 2013 7:24 am
by 15664465
I mean making larger the lines of certains values like 15.000, 30.000, 45.000, 60.000, 75.000 and 90.000
Re: Marking Axis
Posted: Mon Jun 03, 2013 2:21 pm
by 10050769
Hello Fulcrum,
Thanks for the extra information. I think you can do something as next lines of code:
Code: Select all
Partial Class _Default
Inherits System.Web.UI.Page
Private series1 As Steema.TeeChart.Styles.Bar
Private labelstext As String()
Private ch1 As Steema.TeeChart.Chart
Private Sub InitializeChart()
ch1 = WebChart1.Chart()
labelstext = New String() {"Series1", "Series2", "Series3", "Series4", "Series5", "Series6"}
Dim SeriesBar1 As New Steema.TeeChart.Styles.Bar(ch1)
SeriesBar1.Add(90000)
SeriesBar1.Add(30000)
SeriesBar1.Add(60000)
SeriesBar1.Add(45000)
SeriesBar1.Add(15000)
SeriesBar1.Add(75000)
SeriesBar1.Marks.Visible = False
ch1.Legend.Visible = False
ch1.Series(0).ShowInLegend = False
ch1.Walls.Back.Gradient.Visible = False
ch1.Walls.Back.Color = Color.White
ch1.Panel.Gradient.Visible = False
ch1.Panel.Color = Color.White
ch1.Axes.Bottom.Labels.Angle = 30
SeriesBar1.Color = Color.Blue
SeriesBar1.Gradient.StartColor = Color.RoyalBlue
SeriesBar1.Gradient.MiddleColor = Color.DodgerBlue
SeriesBar1.Gradient.EndColor = Color.DeepSkyBlue
SeriesBar1.Pen.Visible = False
SeriesBar1.Gradient.UseMiddle = True
SeriesBar1.Gradient.Visible = True
SeriesBar1.BarStyle = Steema.TeeChart.Styles.BarStyles.RectGradient
AddCustomLabels(SeriesBar1, labelstext)
ch1.Axes.Left.Ticks.Width = 3
ch1.Axes.Left.Ticks.Length = 15
ch1.Axes.Left.Ticks.Color = Color.Red
ch1.Axes.Left.Labels.Style = Steema.TeeChart.AxisLabelStyle.Value
ch1.Panel.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None
'INITIALIZE EVENT GETAXISDRAWLABELS
AddHandler ch1.Axes.Left.GetAxisDrawLabel, AddressOf Left_GetAxisDrawLabel
'EXPORT IMAGE
Dim JpegBarras1 As Steema.TeeChart.Export.JPEGFormat = ch1.Export.Image.JPEG
JpegBarras1.Quality = 100
JpegBarras1.Width = 900 'm_PictureBox.Width
JpegBarras1.Height = 700 'm_PictureBox.Height
WebChart1.Chart.Export.Image.JPEG.Save("C:\ImagenInformeTripleBarras1Final.jpeg")
End Sub
Protected Sub AddCustomLabels(ByVal s As Steema.TeeChart.Styles.Series, ByVal arraylabels As String())
ch1.Chart.Axes.Bottom.Labels.Items.Clear()
For i As Integer = 0 To s.Count - 1
ch1.Chart.Axes.Bottom.Labels.Items.Add(s.XValues(i), arraylabels(i))
Next
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
InitializeChart()
End Sub
Protected Sub Left_GetAxisDrawLabel(ByVal sender As Object, ByVal e As Steema.TeeChart.GetAxisDrawLabelEventArgs)
Dim left As Steema.TeeChart.Axis
left = sender
left.Labels.Font.Bold = False
If (e.Text = "15.000" Or e.Text = "30.000" Or e.Text = "45.000" Or e.Text = "60.000" Or e.Text = "75.000" Or e.Text = "90.000") Then
left.Ticks.Color = Color.Red
left.Ticks.Length = 7
left.Labels.Font.Bold = True
End If
End Sub
Could you check previous code and tell us if it help you to achieve as you want?
Thanks,
Re: Marking Axis
Posted: Tue Jun 04, 2013 8:28 am
by 15664465
Hello Sandra,
I have probed your code and it marks the ticks of the axis, and i want to mark the line inside the chart like in the image of the first post
Re: Marking Axis
Posted: Tue Jun 04, 2013 3:05 pm
by 10050769
Hello Fulcrum,
I have modified my code, because you can draw lines behind the Series with the values as you want, please check if code works in your end.
Code: Select all
Private series1 As Steema.TeeChart.Styles.Bar
Private labelstext As String()
Private ch1 As Steema.TeeChart.Chart
Private Sub InitializeChart()
ch1 = WebChart1.Chart()
labelstext = New String() {"Series1", "Series2", "Series3", "Series4", "Series5", "Series6"}
Dim SeriesBar1 As New Steema.TeeChart.Styles.Bar(ch1)
SeriesBar1.Add(90000)
SeriesBar1.Add(30000)
SeriesBar1.Add(60000)
SeriesBar1.Add(45000)
SeriesBar1.Add(15000)
SeriesBar1.Add(75000)
SeriesBar1.Marks.Visible = False
ch1.Legend.Visible = False
ch1.Series(0).ShowInLegend = False
ch1.Walls.Back.Gradient.Visible = False
ch1.Walls.Back.Color = Color.White
ch1.Panel.Gradient.Visible = False
ch1.Panel.Color = Color.White
ch1.Axes.Bottom.Labels.Angle = 30
SeriesBar1.Color = Color.Blue
SeriesBar1.Gradient.StartColor = Color.RoyalBlue
SeriesBar1.Gradient.MiddleColor = Color.DodgerBlue
SeriesBar1.Gradient.EndColor = Color.DeepSkyBlue
SeriesBar1.Pen.Visible = False
SeriesBar1.Gradient.UseMiddle = True
SeriesBar1.Gradient.Visible = True
SeriesBar1.BarStyle = Steema.TeeChart.Styles.BarStyles.RectGradient
AddCustomLabels(SeriesBar1, labelstext)
' AddHandler WebChart1.GetAxisLabel, AddressOf WebChart1_GetAxisLabel
ch1.Axes.Left.Labels.Style = Steema.TeeChart.AxisLabelStyle.Value
ch1.Panel.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None
AddHandler WebChart1.BeforeDrawSeries, AddressOf WebChart1_BeforeDrawSeries
Dim JpegBarras1 As Steema.TeeChart.Export.JPEGFormat = ch1.Export.Image.JPEG
JpegBarras1.Quality = 100
JpegBarras1.Width = 900 'm_PictureBox.Width
JpegBarras1.Height = 700 'm_PictureBox.Height
WebChart1.Chart.Export.Image.JPEG.Save("C:\ImagenInformeTripleBarras1Final.jpeg")
End Sub
Protected Sub AddCustomLabels(ByVal s As Steema.TeeChart.Styles.Series, ByVal arraylabels As String())
ch1.Chart.Axes.Bottom.Labels.Items.Clear()
For i As Integer = 0 To s.Count - 1
ch1.Chart.Axes.Bottom.Labels.Items.Add(s.XValues(i), arraylabels(i))
Next
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
InitializeChart()
End Sub
Protected Sub WebChart1_BeforeDrawSeries(ByVal sender As Object, ByVal g As Steema.TeeChart.Drawing.Graphics3D)
g.Pen.Color = Color.Red
g.Pen.Width = 2
Dim x0 As Integer, x1 As Integer, y0 As Integer, y1 As Integer, z As Integer
For Each value As Double In ch1(0).YValues.Value
x0 = ch1.Axes.Bottom.IStartPos
y0 = ch1.Axes.Left.CalcPosValue(value)
x1 = ch1.Axes.Bottom.IEndPos
y1 = ch1.Axes.Left.CalcPosValue(value)
z = ch1.Axes.Depth.IEndPos
g.Line(x0, y0, x1, y1, z)
Next
End Sub
I hope will helps.
Thanks,
Re: Marking Axis
Posted: Thu Jun 13, 2013 7:45 am
by 15664465
Thanks Sandra,
the code work properly