Setting chart colors using script

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
shoey
Newbie
Newbie
Posts: 9
Joined: Mon Aug 27, 2007 12:00 am

Setting chart colors using script

Post by shoey » Wed Sep 05, 2007 1:08 am

Is it possible to set font colors on the applet via javascript?

e.g. For the header
tChart1.getChart().getHeader().setColor ?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Sep 05, 2007 8:34 am

Hi shoey,

Yes, you can try this:

Code: Select all

                tChart.getHeader().getFont().setColor(Color.BLUE);
                tChart.getHeader().setTransparent(false);
                tChart.getHeader().setColor(Color.RED);
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

shoey
Newbie
Newbie
Posts: 9
Joined: Mon Aug 27, 2007 12:00 am

Post by shoey » Thu Sep 06, 2007 12:50 am

Hi Narcis,

Does the applet have a function to create a color? If I try to run this from a web page I can not use Color.Red. I would first need a function to create the color. Something like this perhaps:

tChart.getHeader().setColor( tChart1.createColor(255, 0, 0));

Thanks

tom
Advanced
Posts: 211
Joined: Mon Dec 01, 2003 5:00 am
Contact:

Post by tom » Sun Sep 09, 2007 9:22 pm

Sorry, I think we misunderstand your questions, how would you like to use our component with JavaScript? Can you provide us an example of an html page which shows us the functionality you need?

In an applet you would use something like this:

Code: Select all

import com.steema.teechart.TChart;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;

public class TChartApplet extends JApplet {
    
    TChart chart;
    JButton colorButton;
    
    public void init() {        
        Container content = getContentPane();
        content.setBackground(Color.white);
        content.setLayout(new BorderLayout());         
        chart = new TChart();
        content.add(chart, BorderLayout.CENTER);        
        colorButton = new JButton("Color");
        colorButton.addActionListener( new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                chart.setBackColor(Color.RED);
                //or chart.setBackColor(new Color(255,0,0));
            }
        });
        content.add(colorButton, BorderLayout.NORTH);
    }
}
But from your questions on the forum, I'm guessing this is not the kind of information you need.

Regards,
tom

Post Reply