?
Solved

Dynamically change NET4 Chart Title

Posted on 2014-04-28
2
Medium Priority
?
1,856 Views
Last Modified: 2014-04-30
Hello Experts,

I have a net4 chart named chart_1.

I need vb code to  add title and sub title to chart_1

How do I
- specify the text
- center it
- font Ariel
- size 12
- Bold
- color black

I need code for both the title and the sub title (appears below title)

Thank you very much.

CGee
0
Comment
Question by:williecg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 26

Accepted Solution

by:
Alan Warren earned 2000 total points
ID: 40029032
Hi CGee,

something like this oughta get you off in the right direction:
                ' not sure if titles collection is a zero based index 
                If Chart1.Titles(1) IsNot Nothing Then
                  ' specify the text
                  Chart1.Titles(1).Text = FormatDateTime(Date.Now, DateFormat.LongDate)
                  ' center it
                  Chart1.Titles(1).Alignment = Drawing.ContentAlignment.TopCenter
                  ' font Ariel, size 12, Bold
                  Chart1.Titles(1).Font = New System.Drawing.Font("Ariel", 12, Drawing.FontStyle.Bold, Chart1.Titles(1).Font.Unit)
                  ' color black
                  Chart1.Titles(1).ForeColor = Drawing.Color.Black
                  
                End If
                
                ' should be the same for subtitle except increment the index e.g., Chart1.Titles(2)

Open in new window

Respectfully yours,
Alan
0
 

Author Comment

by:williecg
ID: 40032981
Great, thanks so much, works great.  I had to add the title to the chart, then it work.

Chart_1.Titles.Add(0)
            Chart_1.Titles(0).Text = "Main Title"
            Chart_1.Titles(0).Alignment = Drawing.ContentAlignment.TopCenter
            Chart_1.Titles(0).Font = New System.Drawing.Font("Ariel", 12, Drawing.FontStyle.Bold, Chart_1.Titles(0).Font.Unit)
            Chart_1.Titles(0).ForeColor = Drawing.Color.Black

            Chart_1.Titles.Add(1)
            Chart_1.Titles(1).Text = "Subtitle"
            Chart_1.Titles(1).Alignment = Drawing.ContentAlignment.TopCenter
            Chart_1.Titles(1).Font = New System.Drawing.Font("Ariel", 8, Drawing.FontStyle.Bold, Chart_1.Titles(0).Font.Unit)
            Chart_1.Titles(1).ForeColor = Drawing.Color.Black
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question