473,765 Members | 2,070 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how color a line in canvas

Hi Frnds,

I want to know about, how to use color in canvas in
javascript.
Bcoz im using canvas in javascript for plotting line graph,

I have plotted the linegraph, now i need to differentiate the
values, so i want to give different color for each line plotted. But i
dont know how to color a line ,

Can anyone tell me the solution?

Another i want to know, Can i ask these canvas doubts in this
javascript group. If i should ask these doubts means , where should im
ask?

Thanks&Rgrds..
Dinesh...

Sep 7 '06 #1
2 2489
wrote on 07 sep 2006 in comp.lang.javas cript:
Hi Frnds,

I want to know about, how to use color in canvas in
javascript.
Bcoz im using canvas in javascript for plotting line graph,
Please write complete words, this is not SMS, there is room enough.

I have plotted the linegraph, now i need to differentiate the
values, so i want to give different color for each line plotted. But i
dont know how to color a line ,
I already answered your question here:
Subject: Re: how to simple line graph throygh CANVAS
Date: Wed, 06 Sep 2006 08:25:55 +0200
Newsgroups: xs4all:comp.lan g.javascript

wrote on 06 sep 2006 in comp.lang.javas cript:
> Im want to draw a linegraph dynamically through canvas.
So I want a sample line graph code and how to draw lines
between pixels.

Can anyone give me some sample code on canvas for these
things
[...]
>
If you mean your window by canvas:

<http://devrijehuisarts .org/test/jsgraph.asp>

So please study the code, and you will see how the lines are coloured.
Can anyone tell me the solution?
There is no "the" solution, there are many ways to Rome, start by
studying Javascript and CSS.
Another i want to know, Can i ask these canvas doubts in this
javascript group. If i should ask these doubts means , where should im
ask?
"Canvas" is not a word used in html, etc. Html in a browser is not a
paint programme.

You can ask about colours in a CSS NG, and about Javascript in this one,
but show first that you tried it yourself by showing some code.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Sep 7 '06 #2


Evertjan. wrote:

"Canvas" is not a word used in html, etc. Html in a browser is not a
paint programme.
Firefox 1.5, Opera 9 and Safari (since 1.3?) do support a canvas element
in HTML and XHTML that has the sole purpose of exposing a drawing API to
script:
<http://developer.mozil la.org/en/docs/Canvas_tutorial >

--

Martin Honnen
http://JavaScript.FAQTs.com/
Sep 7 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2208
by: Mickel Grönroos | last post by:
Hi, I'm trying to put an Tkinter.Entry of fixed size onto a specific location on a canvas using the place manager. The idea is that one can double-click a rectangle object on a canvas to get an entry field of the same size as the rectangle placed exactly over the rectangle thus creating the effect that the rectangle has entered "input mode". When clicking return in the entry field, the value is fed back to a text object within the...
1
3012
by: Ben Bush | last post by:
I tested the following code and wanted to make oval 2 become red after I hit the enter key but though the code did not report error, it did not change. from Tkinter import * root=Tk() canvas=Canvas(root,width=100,height=100) canvas.pack() canvas.create_oval(10,10,20,20,tags='oval1',fill='blue') canvas.create_oval(50,50,80,80,tags='oval2',fill='yellow') def turnRed(self, event):
2
3335
by: balakrishnan.dinesh | last post by:
Hi, Will any one suggest a way for implementing the line graphs in various browsers without compatability issues. I mean canvas can be used in Mozilla FireFox 1.5 for drawing objects but where as it is not supported in other browers like IE and Netscape. Similarly IE can use VML for drawing objects where as Netscape and Mozilla wont. With Regards Dinesh
1
1680
by: balakrishnan.dinesh | last post by:
hi frnds, Im want to draw a linegraph dynamically through canvas. So I want a sample line graph code and how to draw lines between pixels. Can anyone give me some sample code on canvas for these things Rgrds.. Dinesh...
4
9144
by: skanemupp | last post by:
mapq = PhotoImage(file = 'C:\Users\saftarn\Desktop\elmapovic.gif') w.create_image(10, 10, image = mapq, anchor = NW) after doing this is there any possibility of getting the characteristics of the GIF-picture(or bitmap if i use that)? it would be very helpfull if i for example could do something like canvas.getcolor(image, mouseclick.x,mouseclick.y) if u get the point. get the color of the image where i clicked.
4
10097
by: moondaddy | last post by:
I have a wpf project where I use a canvas to drag shapes around. when I drag a shape beyond the right or bottom side I get scrollbars which is good. I also get scrollbars when I zoom in and a shape goes beyond the right or bottom side. However, I don't get scrollbars when shapes move beyond the left or top side of the canvas. This is bad. I need the behavior similar to Visio where you can drag an object past the left or top and you will...
1
3189
by: Linda Liu[MSFT] | last post by:
Hi George, I have downloaded your sample project and built it on my machine. When I start the application and click the Button on the window, I get an InvalidCastException on the line of code "double topLeft = (double)values;" in the Convert method within the LineBindingConverter class. I look into the parameter "values" and find the first element in it is of type DependencyProperty.UnsetValue. Open the source code of the Window1 and
3
3069
by: goldreads | last post by:
Hey guys, I've been putting together a line graph in Image_Graph. And I can't seem to find an answer to change the layout of few things. Here is my graph: http://www.goldreads.com/test.png 1) I'm trying to bold the line. 2) I would also like to make the title bold... 3) I want to include a text inside the graph in the right corner
19
3988
by: david.karr | last post by:
If in my CSS I set the "background-color" property on the "body" element, it only covers the background of the elements defined in the body, up to the current width and height of the page. However, if the current component set has a resulting small height, this leaves most of the page with the original background color (white). However, if I set the property on the "html" element instead, it does color the entire visible page, beyond the...
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10164
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7379
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5277
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.